diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/BundleCreationClaimantScenarioTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/BundleCreationClaimantScenarioTest.java
index d35713f3a22..c23ce160de4 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/BundleCreationClaimantScenarioTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/BundleCreationClaimantScenarioTest.java
@@ -10,7 +10,6 @@
import uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.claimant.BundleCreationClaimantNotificationHandler;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder;
-import uk.gov.hmcts.reform.dashboard.data.TaskStatus;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -53,10 +52,8 @@ void should_create_bundle_created_scenario() throws Exception {
doGet(BEARER_TOKEN, GET_TASKS_ITEMS_URL, caseId, "CLAIMANT")
.andExpectAll(
status().is(HttpStatus.OK.value()),
- jsonPath("$[0].taskNameEn").value("Add the trial arrangements"),
- jsonPath("$[0].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
- jsonPath("$[1].reference").value(caseId.toString()),
- jsonPath("$[1].taskNameEn").value(
+ jsonPath("$[0].reference").value(caseId.toString()),
+ jsonPath("$[0].taskNameEn").value(
"View the bundle")
);
}
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/BundleUpdatedClaimantScenarioTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/BundleUpdatedClaimantScenarioTest.java
index 8f027ccb98e..3373d06ddc0 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/BundleUpdatedClaimantScenarioTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/BundleUpdatedClaimantScenarioTest.java
@@ -13,7 +13,6 @@
import uk.gov.hmcts.reform.civil.model.IdValue;
import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder;
import uk.gov.hmcts.reform.civil.utils.DateUtils;
-import uk.gov.hmcts.reform.dashboard.data.TaskStatus;
import java.time.LocalDateTime;
import java.util.List;
@@ -103,10 +102,8 @@ private void verifyNotification(String caseId, String role, boolean isCreated, b
if (isFastTrack) {
taskListResultActions.andExpectAll(
status().is(HttpStatus.OK.value()),
- jsonPath("$[0].taskNameEn").value("Add the trial arrangements"),
- jsonPath("$[0].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
- jsonPath("$[1].reference").value(caseId.toString()),
- jsonPath("$[1].taskNameEn").value(
+ jsonPath("$[0].reference").value(caseId.toString()),
+ jsonPath("$[0].taskNameEn").value(
"View the bundle")
);
}
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/TrialArrangementsCheckClaimantScenarioTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/TrialArrangementsCheckClaimantScenarioTest.java
new file mode 100644
index 00000000000..9ee15a4686c
--- /dev/null
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/TrialArrangementsCheckClaimantScenarioTest.java
@@ -0,0 +1,111 @@
+package uk.gov.hmcts.reform.civil.controllers.dashboard.scenarios.claimant;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import uk.gov.hmcts.reform.civil.controllers.CaseProgressionDashboardBaseIntegrationTest;
+import uk.gov.hmcts.reform.civil.enums.YesOrNo;
+import uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.claimant.TrialReadyCheckClaimantNotificationHandler;
+import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder;
+import uk.gov.hmcts.reform.dashboard.data.TaskStatus;
+
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class TrialArrangementsCheckClaimantScenarioTest extends CaseProgressionDashboardBaseIntegrationTest {
+
+ @Autowired
+ private TrialReadyCheckClaimantNotificationHandler handler;
+
+ @Test
+ void should_close_claimant_trial_arrangements_when_trial_arrangements_not_finalised() throws Exception {
+
+ String caseId = "10002348";
+ CaseData caseData = CaseDataBuilder.builder().atStateAwaitingResponseNotFullDefenceReceived().build()
+ .toBuilder()
+ .legacyCaseReference("reference")
+ .ccdCaseReference(Long.valueOf(caseId))
+ .applicant1Represented(YesOrNo.NO)
+ .build();
+
+ handler.handle(callbackParams(caseData));
+
+ //Verify Notification is created
+ doGet(BEARER_TOKEN, GET_NOTIFICATIONS_URL, caseId, "CLAIMANT")
+ .andExpect(status().isOk())
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0]").doesNotExist()
+ );
+
+ doGet(BEARER_TOKEN, GET_TASKS_ITEMS_URL, caseId, "CLAIMANT")
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0].reference").value(caseId.toString()),
+ jsonPath("$[0].taskNameEn").value(
+ "Add the trial arrangements"),
+ jsonPath("$[0].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
+ jsonPath("$[0].taskNameCy").value(
+ "Ychwanegu trefniadau'r treial"),
+ jsonPath("$[0].currentStatusCy").value(TaskStatus.INACTIVE.getWelshName())
+ );
+ }
+
+ @Test
+ void should_not_do_anything_for_claimant_when_trial_arrangements_finalised() throws Exception {
+
+ String caseId = "10002348";
+ CaseData caseData = CaseDataBuilder.builder().atStateAwaitingResponseNotFullDefenceReceived().build()
+ .toBuilder()
+ .legacyCaseReference("reference")
+ .ccdCaseReference(Long.valueOf(caseId))
+ .applicant1Represented(YesOrNo.NO)
+ .trialReadyApplicant(YesOrNo.NO)
+ .build();
+
+ handler.handle(callbackParams(caseData));
+
+ //Verify Notification is created
+ doGet(BEARER_TOKEN, GET_NOTIFICATIONS_URL, caseId, "CLAIMANT")
+ .andExpect(status().isOk())
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0]").doesNotExist()
+ );
+
+ doGet(BEARER_TOKEN, GET_TASKS_ITEMS_URL, caseId, "CLAIMANT")
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0].reference").doesNotExist()
+ );
+ }
+
+ @Test
+ void should_not_do_anything_for_claimant_when_small_claims() throws Exception {
+
+ String caseId = "10002348";
+ CaseData caseData = CaseDataBuilder.builder().atStateClaimSubmittedSmallClaim().build()
+ .toBuilder()
+ .legacyCaseReference("reference")
+ .ccdCaseReference(Long.valueOf(caseId))
+ .applicant1Represented(YesOrNo.NO)
+ .build();
+
+ handler.handle(callbackParams(caseData));
+
+ //Verify Notification is created
+ doGet(BEARER_TOKEN, GET_NOTIFICATIONS_URL, caseId, "CLAIMANT")
+ .andExpect(status().isOk())
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0]").doesNotExist()
+ );
+
+ doGet(BEARER_TOKEN, GET_TASKS_ITEMS_URL, caseId, "CLAIMANT")
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0].reference").doesNotExist()
+ );
+ }
+}
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/BundleCreationDefendantScenarioTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/BundleCreationDefendantScenarioTest.java
index 11352be07e9..4e90db4851b 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/BundleCreationDefendantScenarioTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/BundleCreationDefendantScenarioTest.java
@@ -10,7 +10,6 @@
import uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.defendant.BundleCreationDefendantNotificationHandler;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder;
-import uk.gov.hmcts.reform.dashboard.data.TaskStatus;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -126,10 +125,8 @@ void should_create_bundle_created_scenario_when_fast_track() throws Exception {
doGet(BEARER_TOKEN, GET_TASKS_ITEMS_URL, caseId, "DEFENDANT")
.andExpectAll(
status().is(HttpStatus.OK.value()),
- jsonPath("$[0].taskNameEn").value("Add the trial arrangements"),
- jsonPath("$[0].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
- jsonPath("$[1].reference").value(caseId.toString()),
- jsonPath("$[1].taskNameEn").value(
+ jsonPath("$[0].reference").value(caseId.toString()),
+ jsonPath("$[0].taskNameEn").value(
"View the bundle")
);
}
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/BundleUpdatedDefendantScenarioTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/BundleUpdatedDefendantScenarioTest.java
index 11374113475..1e5369ec458 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/BundleUpdatedDefendantScenarioTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/BundleUpdatedDefendantScenarioTest.java
@@ -13,7 +13,6 @@
import uk.gov.hmcts.reform.civil.model.IdValue;
import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder;
import uk.gov.hmcts.reform.civil.utils.DateUtils;
-import uk.gov.hmcts.reform.dashboard.data.TaskStatus;
import java.time.LocalDateTime;
import java.util.List;
@@ -107,10 +106,8 @@ private void verifyNotification(String caseId, String role, boolean isCreated, b
if (isFastTrack) {
taskListResultActions.andExpectAll(
status().is(HttpStatus.OK.value()),
- jsonPath("$[0].taskNameEn").value("Add the trial arrangements"),
- jsonPath("$[0].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
- jsonPath("$[1].reference").value(caseId.toString()),
- jsonPath("$[1].taskNameEn").value(
+ jsonPath("$[0].reference").value(caseId.toString()),
+ jsonPath("$[0].taskNameEn").value(
"View the bundle")
);
}
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/TrialArrangementsCheckDefendantScenarioTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/TrialArrangementsCheckDefendantScenarioTest.java
new file mode 100644
index 00000000000..c9a6ff781df
--- /dev/null
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/TrialArrangementsCheckDefendantScenarioTest.java
@@ -0,0 +1,111 @@
+package uk.gov.hmcts.reform.civil.controllers.dashboard.scenarios.defendant;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import uk.gov.hmcts.reform.civil.controllers.CaseProgressionDashboardBaseIntegrationTest;
+import uk.gov.hmcts.reform.civil.enums.YesOrNo;
+import uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.defendant.TrialReadyCheckDefendantNotificationHandler;
+import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder;
+import uk.gov.hmcts.reform.dashboard.data.TaskStatus;
+
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class TrialArrangementsCheckDefendantScenarioTest extends CaseProgressionDashboardBaseIntegrationTest {
+
+ @Autowired
+ private TrialReadyCheckDefendantNotificationHandler handler;
+
+ @Test
+ void should_close_defendant_trial_arrangements_when_trial_arrangements_not_finalised() throws Exception {
+
+ String caseId = "10002348";
+ CaseData caseData = CaseDataBuilder.builder().atStateAwaitingResponseNotFullDefenceReceived().build()
+ .toBuilder()
+ .legacyCaseReference("reference")
+ .ccdCaseReference(Long.valueOf(caseId))
+ .respondent1Represented(YesOrNo.NO)
+ .build();
+
+ handler.handle(callbackParams(caseData));
+
+ //Verify Notification is created
+ doGet(BEARER_TOKEN, GET_NOTIFICATIONS_URL, caseId, "DEFENDANT")
+ .andExpect(status().isOk())
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0]").doesNotExist()
+ );
+
+ doGet(BEARER_TOKEN, GET_TASKS_ITEMS_URL, caseId, "DEFENDANT")
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0].reference").value(caseId.toString()),
+ jsonPath("$[0].taskNameEn").value(
+ "Add the trial arrangements"),
+ jsonPath("$[0].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
+ jsonPath("$[0].taskNameCy").value(
+ "Ychwanegu trefniadau'r treial"),
+ jsonPath("$[0].currentStatusCy").value(TaskStatus.INACTIVE.getWelshName())
+ );
+ }
+
+ @Test
+ void should_not_do_anything_for_defendant_when_trial_arrangements_finalised() throws Exception {
+
+ String caseId = "10002348";
+ CaseData caseData = CaseDataBuilder.builder().atStateAwaitingResponseNotFullDefenceReceived().build()
+ .toBuilder()
+ .legacyCaseReference("reference")
+ .ccdCaseReference(Long.valueOf(caseId))
+ .respondent1Represented(YesOrNo.NO)
+ .trialReadyRespondent1(YesOrNo.NO)
+ .build();
+
+ handler.handle(callbackParams(caseData));
+
+ //Verify Notification is created
+ doGet(BEARER_TOKEN, GET_NOTIFICATIONS_URL, caseId, "DEFENDANT")
+ .andExpect(status().isOk())
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0]").doesNotExist()
+ );
+
+ doGet(BEARER_TOKEN, GET_TASKS_ITEMS_URL, caseId, "DEFENDANT")
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0].reference").doesNotExist()
+ );
+ }
+
+ @Test
+ void should_not_do_anything_for_defendant_when_small_claims() throws Exception {
+
+ String caseId = "10002348";
+ CaseData caseData = CaseDataBuilder.builder().atStateClaimSubmittedSmallClaim().build()
+ .toBuilder()
+ .legacyCaseReference("reference")
+ .ccdCaseReference(Long.valueOf(caseId))
+ .respondent1Represented(YesOrNo.NO)
+ .build();
+
+ handler.handle(callbackParams(caseData));
+
+ //Verify Notification is created
+ doGet(BEARER_TOKEN, GET_NOTIFICATIONS_URL, caseId, "DEFENDANT")
+ .andExpect(status().isOk())
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0]").doesNotExist()
+ );
+
+ doGet(BEARER_TOKEN, GET_TASKS_ITEMS_URL, caseId, "DEFENDANT")
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0].reference").doesNotExist()
+ );
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/callback/CaseEvent.java b/src/main/java/uk/gov/hmcts/reform/civil/callback/CaseEvent.java
index 0480b4a8a54..3e04d5925af 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/callback/CaseEvent.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/callback/CaseEvent.java
@@ -544,7 +544,9 @@ public enum CaseEvent {
CREATE_DASHBOARD_NOTIFICATION_COSC_NOT_PAID_FULL_DEFENDANT(CAMUNDA),
CREATE_DASHBOARD_NOTIFICATION_STAY_LIFTED_CLAIMANT(CAMUNDA),
CREATE_DASHBOARD_NOTIFICATION_STAY_LIFTED_DEFENDANT(CAMUNDA),
- NOTIFY_APPLICANT_SOLICITOR1_FOR_PAID_IN_FULL_COSC(CAMUNDA);
+ NOTIFY_APPLICANT_SOLICITOR1_FOR_PAID_IN_FULL_COSC(CAMUNDA),
+ CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_CLAIMANT1(CAMUNDA),
+ CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_DEFENDANT1(CAMUNDA);
private final UserType userType;
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/DashboardScenarios.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/DashboardScenarios.java
index 1259593c666..3f79fe55b85 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/DashboardScenarios.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/DashboardScenarios.java
@@ -121,8 +121,6 @@ public enum DashboardScenarios {
SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_REQUIRED_CLAIMANT("Scenario.AAA6.CP.Trial.Arrangements.Required.Claimant"),
SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_REQUIRED_DEFENDANT("Scenario.AAA6.CP.Trial.Arrangements.Required.Defendant"),
SCENARIO_AAA6_CP_HEARING_FEE_REQUIRED_CLAIMANT("Scenario.AAA6.CP.HearingFee.Required.Claimant"),
- SCENARIO_AAA6_BUNDLE_CREATED_CLAIMANT("Scenario.AAA6.CP.Bundle.Ready.Claimant"),
- SCENARIO_AAA6_BUNDLE_CREATED_DEFENDANT("Scenario.AAA6.CP.Bundle.Ready.Defendant"),
SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_CLAIMANT_CARM("Scenario.AAA6.MediationUnsuccessful.TrackChange.CARM.Claimant"),
SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_CLAIMANT_WITHOUT_UPLOAD_FILES_CARM("Scenario.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Claimant"),
SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_DEFENDANT_CARM("Scenario.AAA6.MediationUnsuccessful.TrackChange.CARM.Defendant"),
@@ -186,8 +184,6 @@ public enum DashboardScenarios {
SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_NOTIFY_OTHER_PARTY_LR_CLAIMANT("Scenario.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Lr.Claimant"),
SCENARIO_AAA6_CLAIMANT_INTENT_CLAIMANT_ENDS_CLAIM_CLAIMANT("Scenario.AAA6.ClaimantIntent.ClaimantEndsClaim.Claimant"),
SCENARIO_AAA6_CLAIMANT_INTENT_CLAIMANT_ENDS_CLAIM_DEFENDANT("Scenario.AAA6.ClaimantIntent.ClaimantEndsClaim.Defendant"),
- SCENARIO_AAA6_CP_BUNDLE_UPDATED_CLAIMANT("Scenario.AAA6.CP.Bundle.Updated.Claimant"),
- SCENARIO_AAA6_CP_BUNDLE_UPDATED_DEFENDANT("Scenario.AAA6.CP.Bundle.Updated.Defendant"),
SCENARIO_AAA6_CP_BUNDLE_UPDATED_TRIAL_READY_CLAIMANT("Scenario.AAA6.CP.Bundle.Updated.TrialReady.Claimant"),
SCENARIO_AAA6_CP_BUNDLE_UPDATED_TRIAL_READY_DEFENDANT("Scenario.AAA6.CP.Bundle.Updated.TrialReady.Defendant"),
SCENARIO_AAA6_DEFENDANT_NOC_CLAIMANT_HEARING_FEE_TASK_LIST("Scenario.AAA6.DefendantNoticeOfChange.Claimant.HearingFee.TaskList"),
@@ -217,7 +213,9 @@ public enum DashboardScenarios {
SCENARIO_AAA6_UPDATE_CASE_PROCEED_IN_CASE_MAN_DEFENDANT("Scenario.AAA6.Update.CaseProceedsInCaseman.Defendant"),
SCENARIO_AAA6_UPDATE_CASE_PROCEED_IN_CASE_MAN_DEFENDANT_FAST_TRACK("Scenario.AAA6.Update.CaseProceedsInCaseman.Defendant.FastTrack"),
SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_RELIST_HEARING_CLAIMANT("Scenario.AAA6.CP.Trial.Arrangements.Relist.Hearing.Claimant"),
- SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_RELIST_HEARING_DEFENDANT("Scenario.AAA6.CP.Trial.Arrangements.Relist.Hearing.Defendant");
+ SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_RELIST_HEARING_DEFENDANT("Scenario.AAA6.CP.Trial.Arrangements.Relist.Hearing.Defendant"),
+ SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_CLAIMANT("Scenario.AAA6.CP.TrialReady.Check.Claimant"),
+ SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_DEFENDANT("Scenario.AAA6.CP.TrialReady.Check.Defendant");
private final String scenario;
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleCreationClaimantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleCreationClaimantNotificationHandler.java
index 85f00648c85..83a7eef8695 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleCreationClaimantNotificationHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleCreationClaimantNotificationHandler.java
@@ -6,16 +6,13 @@
import uk.gov.hmcts.reform.civil.callback.CaseProgressionDashboardCallbackHandler;
import uk.gov.hmcts.reform.civil.client.DashboardApiClient;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
-import uk.gov.hmcts.reform.civil.helpers.sdo.SdoHelper;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
import java.util.List;
-import static java.util.Objects.isNull;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_FOR_BUNDLE_CREATED_FOR_CLAIMANT1;
-import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_BUNDLE_CREATED_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_BUNDLE_CREATED_TRIAL_READY_CLAIMANT;
@Service
@@ -42,9 +39,7 @@ public List handledEvents() {
@Override
public String getScenario(CaseData caseData) {
- return isNull(caseData.getTrialReadyApplicant()) && SdoHelper.isFastTrack(caseData)
- ? SCENARIO_AAA6_BUNDLE_CREATED_CLAIMANT.getScenario()
- : SCENARIO_AAA6_BUNDLE_CREATED_TRIAL_READY_CLAIMANT.getScenario();
+ return SCENARIO_AAA6_BUNDLE_CREATED_TRIAL_READY_CLAIMANT.getScenario();
}
@Override
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleUpdatedClaimantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleUpdatedClaimantNotificationHandler.java
index 696149f31e0..712a6f49c29 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleUpdatedClaimantNotificationHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleUpdatedClaimantNotificationHandler.java
@@ -6,16 +6,13 @@
import uk.gov.hmcts.reform.civil.callback.CaseProgressionDashboardCallbackHandler;
import uk.gov.hmcts.reform.civil.client.DashboardApiClient;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
-import uk.gov.hmcts.reform.civil.helpers.sdo.SdoHelper;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
import java.util.List;
-import static java.util.Objects.isNull;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_AMEND_RESTITCH_BUNDLE_CLAIMANT;
-import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_BUNDLE_UPDATED_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_BUNDLE_UPDATED_TRIAL_READY_CLAIMANT;
@Service
@@ -42,9 +39,7 @@ public List handledEvents() {
@Override
public String getScenario(CaseData caseData) {
- return isNull(caseData.getTrialReadyApplicant()) && SdoHelper.isFastTrack(caseData)
- ? SCENARIO_AAA6_CP_BUNDLE_UPDATED_CLAIMANT.getScenario()
- : SCENARIO_AAA6_CP_BUNDLE_UPDATED_TRIAL_READY_CLAIMANT.getScenario();
+ return SCENARIO_AAA6_CP_BUNDLE_UPDATED_TRIAL_READY_CLAIMANT.getScenario();
}
@Override
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/TrialReadyCheckClaimantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/TrialReadyCheckClaimantNotificationHandler.java
new file mode 100644
index 00000000000..76198c4259a
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/TrialReadyCheckClaimantNotificationHandler.java
@@ -0,0 +1,53 @@
+package uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.claimant;
+
+import org.springframework.stereotype.Service;
+import uk.gov.hmcts.reform.civil.callback.CallbackParams;
+import uk.gov.hmcts.reform.civil.callback.CaseEvent;
+import uk.gov.hmcts.reform.civil.callback.CaseProgressionDashboardCallbackHandler;
+import uk.gov.hmcts.reform.civil.client.DashboardApiClient;
+import uk.gov.hmcts.reform.civil.enums.AllocatedTrack;
+import uk.gov.hmcts.reform.civil.enums.YesOrNo;
+import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper;
+import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
+
+import java.util.List;
+
+import static java.util.Objects.isNull;
+import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_CLAIMANT1;
+import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_CLAIMANT;
+
+@Service
+public class TrialReadyCheckClaimantNotificationHandler extends CaseProgressionDashboardCallbackHandler {
+
+ private static final List EVENTS = List.of(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_CLAIMANT1);
+ public static final String TASK_ID = "TrialReadyCheckDashboardNotificationsForClaimant1";
+
+ public TrialReadyCheckClaimantNotificationHandler(DashboardApiClient dashboardApiClient,
+ DashboardNotificationsParamsMapper mapper,
+ FeatureToggleService featureToggleService) {
+ super(dashboardApiClient, mapper, featureToggleService);
+ }
+
+ @Override
+ public String camundaActivityId(CallbackParams callbackParams) {
+ return TASK_ID;
+ }
+
+ @Override
+ public List handledEvents() {
+ return EVENTS;
+ }
+
+ @Override
+ public String getScenario(CaseData caseData) {
+ return SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_CLAIMANT.getScenario();
+ }
+
+ @Override
+ public boolean shouldRecordScenario(CaseData caseData) {
+ return YesOrNo.NO.equals(caseData.getApplicant1Represented())
+ && isNull(caseData.getTrialReadyApplicant())
+ && AllocatedTrack.FAST_CLAIM.name().equals(caseData.getAssignedTrack());
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleCreationDefendantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleCreationDefendantNotificationHandler.java
index 13860059ffa..c7a5b6d42f2 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleCreationDefendantNotificationHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleCreationDefendantNotificationHandler.java
@@ -6,16 +6,13 @@
import uk.gov.hmcts.reform.civil.callback.CaseProgressionDashboardCallbackHandler;
import uk.gov.hmcts.reform.civil.client.DashboardApiClient;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
-import uk.gov.hmcts.reform.civil.helpers.sdo.SdoHelper;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
import java.util.List;
-import static java.util.Objects.isNull;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_FOR_BUNDLE_CREATED_FOR_DEFENDANT1;
-import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_BUNDLE_CREATED_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_BUNDLE_CREATED_TRIAL_READY_DEFENDANT;
@Service
@@ -42,9 +39,7 @@ public List handledEvents() {
@Override
public String getScenario(CaseData caseData) {
- return isNull(caseData.getTrialReadyRespondent1()) && SdoHelper.isFastTrack(caseData)
- ? SCENARIO_AAA6_BUNDLE_CREATED_DEFENDANT.getScenario()
- : SCENARIO_AAA6_BUNDLE_CREATED_TRIAL_READY_DEFENDANT.getScenario();
+ return SCENARIO_AAA6_BUNDLE_CREATED_TRIAL_READY_DEFENDANT.getScenario();
}
@Override
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleUpdatedDefendantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleUpdatedDefendantNotificationHandler.java
index 5770e696691..a8bfb88342d 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleUpdatedDefendantNotificationHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleUpdatedDefendantNotificationHandler.java
@@ -6,16 +6,13 @@
import uk.gov.hmcts.reform.civil.callback.CaseProgressionDashboardCallbackHandler;
import uk.gov.hmcts.reform.civil.client.DashboardApiClient;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
-import uk.gov.hmcts.reform.civil.helpers.sdo.SdoHelper;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
import java.util.List;
-import static java.util.Objects.isNull;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_AMEND_RESTITCH_BUNDLE_DEFENDANT;
-import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_BUNDLE_UPDATED_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_BUNDLE_UPDATED_TRIAL_READY_DEFENDANT;
@Service
@@ -42,9 +39,7 @@ public List handledEvents() {
@Override
public String getScenario(CaseData caseData) {
- return isNull(caseData.getTrialReadyRespondent1()) && SdoHelper.isFastTrack(caseData)
- ? SCENARIO_AAA6_CP_BUNDLE_UPDATED_DEFENDANT.getScenario()
- : SCENARIO_AAA6_CP_BUNDLE_UPDATED_TRIAL_READY_DEFENDANT.getScenario();
+ return SCENARIO_AAA6_CP_BUNDLE_UPDATED_TRIAL_READY_DEFENDANT.getScenario();
}
@Override
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/TrialReadyCheckDefendantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/TrialReadyCheckDefendantNotificationHandler.java
new file mode 100644
index 00000000000..f1dcab8482a
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/TrialReadyCheckDefendantNotificationHandler.java
@@ -0,0 +1,53 @@
+package uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.defendant;
+
+import org.springframework.stereotype.Service;
+import uk.gov.hmcts.reform.civil.callback.CallbackParams;
+import uk.gov.hmcts.reform.civil.callback.CaseEvent;
+import uk.gov.hmcts.reform.civil.callback.CaseProgressionDashboardCallbackHandler;
+import uk.gov.hmcts.reform.civil.client.DashboardApiClient;
+import uk.gov.hmcts.reform.civil.enums.AllocatedTrack;
+import uk.gov.hmcts.reform.civil.enums.YesOrNo;
+import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper;
+import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
+
+import java.util.List;
+
+import static java.util.Objects.isNull;
+import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_DEFENDANT1;
+import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_DEFENDANT;
+
+@Service
+public class TrialReadyCheckDefendantNotificationHandler extends CaseProgressionDashboardCallbackHandler {
+
+ private static final List EVENTS = List.of(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_DEFENDANT1);
+ public static final String TASK_ID = "TrialReadyCheckDashboardNotificationsForDefendant1";
+
+ public TrialReadyCheckDefendantNotificationHandler(DashboardApiClient dashboardApiClient,
+ DashboardNotificationsParamsMapper mapper,
+ FeatureToggleService featureToggleService) {
+ super(dashboardApiClient, mapper, featureToggleService);
+ }
+
+ @Override
+ public String camundaActivityId(CallbackParams callbackParams) {
+ return TASK_ID;
+ }
+
+ @Override
+ public List handledEvents() {
+ return EVENTS;
+ }
+
+ @Override
+ public String getScenario(CaseData caseData) {
+ return SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_DEFENDANT.getScenario();
+ }
+
+ @Override
+ public boolean shouldRecordScenario(CaseData caseData) {
+ return YesOrNo.NO.equals(caseData.getRespondent1Represented())
+ && isNull(caseData.getTrialReadyRespondent1())
+ && AllocatedTrack.FAST_CLAIM.name().equals(caseData.getAssignedTrack());
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/TrialReadyCheckCallbackHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/TrialReadyCheckCallbackHandler.java
index adcbb86196d..fcda5e44558 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/TrialReadyCheckCallbackHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/TrialReadyCheckCallbackHandler.java
@@ -9,12 +9,14 @@
import uk.gov.hmcts.reform.civil.callback.CallbackHandler;
import uk.gov.hmcts.reform.civil.callback.CallbackParams;
import uk.gov.hmcts.reform.civil.callback.CaseEvent;
+import uk.gov.hmcts.reform.civil.model.BusinessProcess;
import uk.gov.hmcts.reform.civil.model.CaseData;
import java.util.List;
import java.util.Map;
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
+import static uk.gov.hmcts.reform.civil.callback.CallbackType.SUBMITTED;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.TRIAL_READY_CHECK;
import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES;
@@ -28,13 +30,15 @@ public class TrialReadyCheckCallbackHandler extends CallbackHandler {
@Override
protected Map callbacks() {
return Map.of(
- callbackKey(ABOUT_TO_SUBMIT), this::setTrialReadyChecked
+ callbackKey(ABOUT_TO_SUBMIT), this::setTrialReadyChecked,
+ callbackKey(SUBMITTED), this::emptySubmittedCallbackResponse
);
}
private CallbackResponse setTrialReadyChecked(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData().toBuilder()
.trialReadyChecked(YES)
+ .businessProcess(BusinessProcess.ready(TRIAL_READY_CHECK))
.build();
return AboutToStartOrSubmitCallbackResponse.builder()
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/TrialReadyNotificationCallbackHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/TrialReadyNotificationCallbackHandler.java
index 6ea4b6b2de2..adeaa9f1927 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/TrialReadyNotificationCallbackHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/TrialReadyNotificationCallbackHandler.java
@@ -49,6 +49,7 @@ private CallbackResponse setTrialReadyNotified(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData().toBuilder()
.businessProcess(BusinessProcess.ready(TRIAL_READY_NOTIFICATION))
.trialReadyNotified(YesOrNo.YES)
+ .trialReadyChecked(null)
.build();
return AboutToStartOrSubmitCallbackResponse.builder()
diff --git a/src/main/resources/db/migration/V2024_12_18_1700__CIV-15723-bundle-to-trial-ready-check.sql b/src/main/resources/db/migration/V2024_12_18_1700__CIV-15723-bundle-to-trial-ready-check.sql
new file mode 100644
index 00000000000..fa4c4be1307
--- /dev/null
+++ b/src/main/resources/db/migration/V2024_12_18_1700__CIV-15723-bundle-to-trial-ready-check.sql
@@ -0,0 +1,37 @@
+/**
+ Update scenarios
+ */
+update dbs.scenario set notifications_to_delete = '{"Notice.AAA6.CP.Bundle.Ready.Claimant"}'
+where name = 'Scenario.AAA6.CP.Bundle.Updated.TrialReady.Claimant';
+update dbs.scenario set notifications_to_delete = '{"Notice.AAA6.CP.Bundle.Ready.Defendant"}'
+where name = 'Scenario.AAA6.CP.Bundle.Updated.TrialReady.Defendant';
+update dbs.scenario set notifications_to_delete = '{"Notice.AAA6.CP.Bundle.Ready.Claimant"}'
+where name = 'Scenario.AAA6.CP.Bundle.Updated.Claimant';
+update dbs.scenario set notifications_to_delete = '{"Notice.AAA6.CP.Bundle.Ready.Defendant"}'
+where name = 'Scenario.AAA6.CP.Bundle.Updated.Defendant';
+update dbs.scenario set notifications_to_delete = '{}'
+where name = 'Scenario.AAA6.CP.Bundle.Ready.TrialReady.Claimant';
+update dbs.scenario set notifications_to_delete = '{}'
+where name = 'Scenario.AAA6.CP.Bundle.Ready.TrialReady.Defendant';
+update dbs.scenario set notifications_to_delete = '{}'
+where name = 'Scenario.AAA6.CP.Bundle.Ready.Claimant';
+update dbs.scenario set notifications_to_delete = '{}'
+where name = 'Scenario.AAA6.CP.Bundle.Ready.Defendant';
+
+/**
+ * Add scenarios
+ */
+INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create)
+VALUES ('Scenario.AAA6.CP.TrialReady.Check.Claimant', '{"Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Claimant", "Notice.AAA6.CP.Trial.Arrangements.Required.Claimant"}', '{}'),
+ ('Scenario.AAA6.CP.TrialReady.Check.Defendant', '{"Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Defendant", "Notice.AAA6.CP.Trial.Arrangements.Required.Defendant"}', '{}');
+
+/**
+ * Add task item template
+ */
+
+INSERT INTO dbs.task_item_template (task_name_en, category_en, task_name_cy, category_cy, template_name,
+ scenario_name, task_status_sequence, role, task_order)
+values ('Add the trial arrangements', 'Hearing' ,'Ychwanegu trefniadau''r treial',
+ 'Gwrandawiad', 'Hearing.Arrangements.Add', 'Scenario.AAA6.CP.TrialReady.Check.Claimant', '{2, 2}', 'CLAIMANT', 12),
+ ('Add the trial arrangements', 'Hearing' ,'Ychwanegu trefniadau''r treial',
+ 'Gwrandawiad', 'Hearing.Arrangements.Add', 'Scenario.AAA6.CP.TrialReady.Check.Defendant', '{2, 2}', 'DEFENDANT', 11);
diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleCreationClaimantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleCreationClaimantNotificationHandlerTest.java
index efcdb8baff6..cda90f97138 100644
--- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleCreationClaimantNotificationHandlerTest.java
+++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleCreationClaimantNotificationHandlerTest.java
@@ -27,12 +27,11 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.verify;
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_FOR_BUNDLE_CREATED_FOR_CLAIMANT1;
import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO;
-import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_BUNDLE_CREATED_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_BUNDLE_CREATED_TRIAL_READY_CLAIMANT;
@ExtendWith(MockitoExtension.class)
@@ -52,13 +51,14 @@ class AboutToSubmitCallback {
@BeforeEach
void setup() {
- when(dashboardApiClient.recordScenario(any(), any(), anyString(), any())).thenReturn(ResponseEntity.of(
- Optional.empty()));
when(toggleService.isCaseProgressionEnabled()).thenReturn(true);
}
@Test
void shouldRecordScenario_whenInvokedWhenNotTrialReady() {
+ when(dashboardApiClient.recordScenario(any(), any(), anyString(), any())).thenReturn(ResponseEntity.of(
+ Optional.empty()));
+
CaseData caseData = CaseDataBuilder.builder().atStateTrialReadyCheck().build().toBuilder()
.applicant1Represented(YesOrNo.NO)
.drawDirectionsOrderRequired(YesOrNo.YES)
@@ -78,7 +78,7 @@ void shouldRecordScenario_whenInvokedWhenNotTrialReady() {
verify(dashboardApiClient).recordScenario(
caseData.getCcdCaseReference().toString(),
- SCENARIO_AAA6_BUNDLE_CREATED_CLAIMANT.getScenario(),
+ SCENARIO_AAA6_BUNDLE_CREATED_TRIAL_READY_CLAIMANT.getScenario(),
"BEARER_TOKEN",
ScenarioRequestParams.builder().params(scenarioParams).build()
);
@@ -86,6 +86,7 @@ void shouldRecordScenario_whenInvokedWhenNotTrialReady() {
@Test
void shouldRecordScenarioTrialReady_whenInvokedWhenSmallClaimsCase() {
+
CaseData caseData = CaseDataBuilder.builder().atStateTrialReadyCheck().applicant1Represented(YesOrNo.NO).build();
CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_FOR_BUNDLE_CREATED_FOR_CLAIMANT1.name()).build()
diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleUpdatedClaimantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleUpdatedClaimantNotificationHandlerTest.java
index 28da4c1ab9b..ab1a9150c24 100644
--- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleUpdatedClaimantNotificationHandlerTest.java
+++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/BundleUpdatedClaimantNotificationHandlerTest.java
@@ -32,7 +32,6 @@
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_AMEND_RESTITCH_BUNDLE_CLAIMANT;
import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO;
-import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_BUNDLE_UPDATED_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_BUNDLE_UPDATED_TRIAL_READY_CLAIMANT;
@ExtendWith(MockitoExtension.class)
@@ -102,7 +101,7 @@ void shouldRecordFastTrackScenario_whenApplicantNotRepresented() {
verify(dashboardApiClient).recordScenario(
caseData.getCcdCaseReference().toString(),
- SCENARIO_AAA6_CP_BUNDLE_UPDATED_CLAIMANT.getScenario(),
+ SCENARIO_AAA6_CP_BUNDLE_UPDATED_TRIAL_READY_CLAIMANT.getScenario(),
"BEARER_TOKEN",
ScenarioRequestParams.builder().params(scenarioParams).build()
);
diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/TrialReadyCheckClaimantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/TrialReadyCheckClaimantNotificationHandlerTest.java
new file mode 100644
index 00000000000..e03cc2ddfd3
--- /dev/null
+++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/TrialReadyCheckClaimantNotificationHandlerTest.java
@@ -0,0 +1,162 @@
+package uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.claimant;
+
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.springframework.http.ResponseEntity;
+import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest;
+import uk.gov.hmcts.reform.civil.callback.CallbackParams;
+import uk.gov.hmcts.reform.civil.client.DashboardApiClient;
+import uk.gov.hmcts.reform.civil.enums.YesOrNo;
+import uk.gov.hmcts.reform.civil.handler.callback.BaseCallbackHandlerTest;
+import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.sampledata.CallbackParamsBuilder;
+import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder;
+import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper;
+import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
+import uk.gov.hmcts.reform.dashboard.data.ScenarioRequestParams;
+
+import java.util.HashMap;
+import java.util.Optional;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.verify;
+import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
+import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_CLAIMANT1;
+import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_CLAIMANT;
+
+@ExtendWith(MockitoExtension.class)
+public class TrialReadyCheckClaimantNotificationHandlerTest extends BaseCallbackHandlerTest {
+
+ @Mock
+ private DashboardApiClient dashboardApiClient;
+ @Mock
+ private DashboardNotificationsParamsMapper mapper;
+ @Mock
+ private FeatureToggleService toggleService;
+ @InjectMocks
+ private TrialReadyCheckClaimantNotificationHandler handler;
+
+ public static final String TASK_ID = "TrialReadyCheckDashboardNotificationsForClaimant1";
+
+ @Test
+ void handleEventsReturnsTheExpectedCallbackEvent() {
+ assertThat(handler.handledEvents()).contains(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_CLAIMANT1);
+ }
+
+ @Test
+ void shouldReturnCorrectCamundaActivityId_whenInvoked() {
+ assertThat(handler.camundaActivityId(
+ CallbackParamsBuilder.builder()
+ .request(CallbackRequest.builder()
+ .eventId(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_CLAIMANT1.name())
+ .build())
+ .build()))
+ .isEqualTo(TASK_ID);
+ }
+
+ @Nested
+ class AboutToSubmitCallback {
+
+ @Test
+ void shouldRecordScenario_whenInvoked() {
+ CaseData caseData = CaseDataBuilder.builder().atStateHearingDateScheduled()
+ .applicant1Represented(YesOrNo.NO)
+ .responseClaimTrack("FAST_CLAIM")
+ .build();
+ HashMap scenarioParams = new HashMap<>();
+ when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);
+ when(dashboardApiClient.recordScenario(any(), any(), anyString(), any())).thenReturn(ResponseEntity.of(
+ Optional.empty()));
+ when(toggleService.isCaseProgressionEnabled()).thenReturn(true);
+
+ CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
+ CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_CLAIMANT1.name()).build()
+ ).build();
+
+ handler.handle(params);
+ verify(dashboardApiClient).recordScenario(
+ caseData.getCcdCaseReference().toString(),
+ SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_CLAIMANT.getScenario(),
+ "BEARER_TOKEN",
+ ScenarioRequestParams.builder().params(scenarioParams).build()
+ );
+ }
+
+ @Test
+ void shouldNotRecordScenario_whenRepresented() {
+ CaseData caseData = CaseDataBuilder.builder().atStateHearingDateScheduled()
+ .applicant1Represented(YesOrNo.YES)
+ .responseClaimTrack("FAST_CLAIM")
+ .build();
+ HashMap scenarioParams = new HashMap<>();
+ when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);
+ when(toggleService.isCaseProgressionEnabled()).thenReturn(true);
+
+ CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
+ CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_CLAIMANT1.name()).build()
+ ).build();
+
+ handler.handle(params);
+ verify(dashboardApiClient, never()).recordScenario(
+ caseData.getCcdCaseReference().toString(),
+ SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_CLAIMANT.getScenario(),
+ "BEARER_TOKEN",
+ ScenarioRequestParams.builder().params(scenarioParams).build()
+ );
+ }
+
+ @Test
+ void shouldNotRecordScenario_whenSmallClaims() {
+ CaseData caseData = CaseDataBuilder.builder().atStateClaimSubmittedSmallClaim()
+ .applicant1Represented(YesOrNo.NO)
+ .responseClaimTrack("SMALL_CLAIM")
+ .build();
+ HashMap scenarioParams = new HashMap<>();
+ when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);
+ when(toggleService.isCaseProgressionEnabled()).thenReturn(true);
+
+ CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
+ CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_CLAIMANT1.name()).build()
+ ).build();
+
+ handler.handle(params);
+ verify(dashboardApiClient, never()).recordScenario(
+ caseData.getCcdCaseReference().toString(),
+ SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_CLAIMANT.getScenario(),
+ "BEARER_TOKEN",
+ ScenarioRequestParams.builder().params(scenarioParams).build()
+ );
+ }
+
+ @Test
+ void shouldNotRecordScenario_whenTrialReadyIndicated() {
+ CaseData caseData = CaseDataBuilder.builder().atStateTrialReadyApplicant()
+ .applicant1Represented(YesOrNo.NO)
+ .responseClaimTrack("FAST_CLAIM")
+ .build();
+ HashMap scenarioParams = new HashMap<>();
+ when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);
+ when(toggleService.isCaseProgressionEnabled()).thenReturn(true);
+
+ CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
+ CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_CLAIMANT1.name()).build()
+ ).build();
+
+ handler.handle(params);
+ verify(dashboardApiClient, never()).recordScenario(
+ caseData.getCcdCaseReference().toString(),
+ SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_CLAIMANT.getScenario(),
+ "BEARER_TOKEN",
+ ScenarioRequestParams.builder().params(scenarioParams).build()
+ );
+ }
+ }
+}
diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleCreationDefendantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleCreationDefendantNotificationHandlerTest.java
index b5572e23ce6..1c4f4cd290e 100644
--- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleCreationDefendantNotificationHandlerTest.java
+++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleCreationDefendantNotificationHandlerTest.java
@@ -27,12 +27,11 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.verify;
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_FOR_BUNDLE_CREATED_FOR_DEFENDANT1;
import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO;
-import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_BUNDLE_CREATED_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_BUNDLE_CREATED_TRIAL_READY_DEFENDANT;
@ExtendWith(MockitoExtension.class)
@@ -52,13 +51,13 @@ class AboutToSubmitCallback {
@BeforeEach
void setup() {
- when(dashboardApiClient.recordScenario(any(), any(), anyString(), any())).thenReturn(ResponseEntity.of(
- Optional.empty()));
when(toggleService.isCaseProgressionEnabled()).thenReturn(true);
}
@Test
void shouldRecordScenario_whenInvokedWhenNotTrialReady() {
+ when(dashboardApiClient.recordScenario(any(), any(), anyString(), any())).thenReturn(ResponseEntity.of(
+ Optional.empty()));
CaseData caseData = CaseDataBuilder.builder().atStateTrialReadyCheck().build()
.toBuilder().respondent1Represented(YesOrNo.NO)
.drawDirectionsOrderRequired(YesOrNo.YES)
@@ -79,7 +78,7 @@ void shouldRecordScenario_whenInvokedWhenNotTrialReady() {
verify(dashboardApiClient).recordScenario(
caseData.getCcdCaseReference().toString(),
- SCENARIO_AAA6_BUNDLE_CREATED_DEFENDANT.getScenario(),
+ SCENARIO_AAA6_BUNDLE_CREATED_TRIAL_READY_DEFENDANT.getScenario(),
"BEARER_TOKEN",
ScenarioRequestParams.builder().params(scenarioParams).build()
);
diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleUpdatedDefendantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleUpdatedDefendantNotificationHandlerTest.java
index 03df74f5898..4e597a53a7c 100644
--- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleUpdatedDefendantNotificationHandlerTest.java
+++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/BundleUpdatedDefendantNotificationHandlerTest.java
@@ -32,7 +32,6 @@
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_AMEND_RESTITCH_BUNDLE_DEFENDANT;
import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO;
-import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_BUNDLE_UPDATED_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_BUNDLE_UPDATED_TRIAL_READY_DEFENDANT;
@ExtendWith(MockitoExtension.class)
@@ -104,7 +103,7 @@ void shouldRecordScenarioTrialReady_whenRespondentNotRepresented() {
verify(dashboardApiClient).recordScenario(
caseData.getCcdCaseReference().toString(),
- SCENARIO_AAA6_CP_BUNDLE_UPDATED_DEFENDANT.getScenario(),
+ SCENARIO_AAA6_CP_BUNDLE_UPDATED_TRIAL_READY_DEFENDANT.getScenario(),
"BEARER_TOKEN",
ScenarioRequestParams.builder().params(scenarioParams).build()
);
diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/TrialReadyCheckDefendantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/TrialReadyCheckDefendantNotificationHandlerTest.java
new file mode 100644
index 00000000000..bcc0f23ed70
--- /dev/null
+++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/TrialReadyCheckDefendantNotificationHandlerTest.java
@@ -0,0 +1,162 @@
+package uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.defendant;
+
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.springframework.http.ResponseEntity;
+import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest;
+import uk.gov.hmcts.reform.civil.callback.CallbackParams;
+import uk.gov.hmcts.reform.civil.client.DashboardApiClient;
+import uk.gov.hmcts.reform.civil.enums.YesOrNo;
+import uk.gov.hmcts.reform.civil.handler.callback.BaseCallbackHandlerTest;
+import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.sampledata.CallbackParamsBuilder;
+import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder;
+import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper;
+import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
+import uk.gov.hmcts.reform.dashboard.data.ScenarioRequestParams;
+
+import java.util.HashMap;
+import java.util.Optional;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
+import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_DEFENDANT1;
+import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_DEFENDANT;
+
+@ExtendWith(MockitoExtension.class)
+public class TrialReadyCheckDefendantNotificationHandlerTest extends BaseCallbackHandlerTest {
+
+ @Mock
+ private DashboardApiClient dashboardApiClient;
+ @Mock
+ private DashboardNotificationsParamsMapper mapper;
+ @Mock
+ private FeatureToggleService toggleService;
+ @InjectMocks
+ private TrialReadyCheckDefendantNotificationHandler handler;
+
+ public static final String TASK_ID = "TrialReadyCheckDashboardNotificationsForDefendant1";
+
+ @Test
+ void handleEventsReturnsTheExpectedCallbackEvent() {
+ assertThat(handler.handledEvents()).contains(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_DEFENDANT1);
+ }
+
+ @Test
+ void shouldReturnCorrectCamundaActivityId_whenInvoked() {
+ assertThat(handler.camundaActivityId(
+ CallbackParamsBuilder.builder()
+ .request(CallbackRequest.builder()
+ .eventId(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_DEFENDANT1.name())
+ .build())
+ .build()))
+ .isEqualTo(TASK_ID);
+ }
+
+ @Nested
+ class AboutToSubmitCallback {
+
+ @Test
+ void shouldRecordScenario_whenInvoked() {
+ CaseData caseData = CaseDataBuilder.builder().atStateHearingDateScheduled()
+ .respondent1Represented(YesOrNo.NO)
+ .responseClaimTrack("FAST_CLAIM")
+ .build();
+ HashMap scenarioParams = new HashMap<>();
+ when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);
+ when(dashboardApiClient.recordScenario(any(), any(), anyString(), any())).thenReturn(ResponseEntity.of(
+ Optional.empty()));
+ when(toggleService.isCaseProgressionEnabled()).thenReturn(true);
+
+ CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
+ CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_DEFENDANT1.name()).build()
+ ).build();
+
+ handler.handle(params);
+ verify(dashboardApiClient).recordScenario(
+ caseData.getCcdCaseReference().toString(),
+ SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_DEFENDANT.getScenario(),
+ "BEARER_TOKEN",
+ ScenarioRequestParams.builder().params(scenarioParams).build()
+ );
+ }
+
+ @Test
+ void shouldNotRecordScenario_whenRepresented() {
+ CaseData caseData = CaseDataBuilder.builder().atStateHearingDateScheduled()
+ .respondent1Represented(YesOrNo.YES)
+ .responseClaimTrack("FAST_CLAIM")
+ .build();
+ HashMap scenarioParams = new HashMap<>();
+ when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);
+ when(toggleService.isCaseProgressionEnabled()).thenReturn(true);
+
+ CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
+ CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_DEFENDANT1.name()).build()
+ ).build();
+
+ handler.handle(params);
+ verify(dashboardApiClient, never()).recordScenario(
+ caseData.getCcdCaseReference().toString(),
+ SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_DEFENDANT.getScenario(),
+ "BEARER_TOKEN",
+ ScenarioRequestParams.builder().params(scenarioParams).build()
+ );
+ }
+
+ @Test
+ void shouldNotRecordScenario_whenSmallClaims() {
+ CaseData caseData = CaseDataBuilder.builder().atStateClaimSubmittedSmallClaim()
+ .respondent1Represented(YesOrNo.NO)
+ .responseClaimTrack("SMALL_CLAIM")
+ .build();
+ HashMap scenarioParams = new HashMap<>();
+ when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);
+ when(toggleService.isCaseProgressionEnabled()).thenReturn(true);
+
+ CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
+ CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_DEFENDANT1.name()).build()
+ ).build();
+
+ handler.handle(params);
+ verify(dashboardApiClient, never()).recordScenario(
+ caseData.getCcdCaseReference().toString(),
+ SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_DEFENDANT.getScenario(),
+ "BEARER_TOKEN",
+ ScenarioRequestParams.builder().params(scenarioParams).build()
+ );
+ }
+
+ @Test
+ void shouldNotRecordScenario_whenTrialReadyIndicated() {
+ CaseData caseData = CaseDataBuilder.builder().atStateTrialReadyRespondent1()
+ .respondent1Represented(YesOrNo.NO)
+ .responseClaimTrack("FAST_CLAIM")
+ .build();
+ HashMap scenarioParams = new HashMap<>();
+ when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);
+ when(toggleService.isCaseProgressionEnabled()).thenReturn(true);
+
+ CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
+ CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_TRIAL_READY_CHECK_DEFENDANT1.name()).build()
+ ).build();
+
+ handler.handle(params);
+ verify(dashboardApiClient, never()).recordScenario(
+ caseData.getCcdCaseReference().toString(),
+ SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_CHECK_DEFENDANT.getScenario(),
+ "BEARER_TOKEN",
+ ScenarioRequestParams.builder().params(scenarioParams).build()
+ );
+ }
+ }
+}