Skip to content

Commit

Permalink
Added restting the view documents task when case stay is lifted
Browse files Browse the repository at this point in the history
  • Loading branch information
Gareth40342 committed Nov 14, 2024
1 parent 685d170 commit 1d16311
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder;
import uk.gov.hmcts.reform.dashboard.data.TaskStatus;

import java.time.LocalDateTime;

import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
Expand All @@ -30,6 +32,7 @@ void should_create_stay_lifted_claimant_scenario() throws Exception {
.ccdCaseReference(Long.valueOf(caseId))
.ccdState(CaseState.CASE_PROGRESSION)
.preStayState(CaseState.HEARING_READINESS.toString())
.caseDocumentUploadDate(LocalDateTime.now())
.applicant1Represented(YesOrNo.NO)
.build();

Expand Down Expand Up @@ -64,15 +67,25 @@ void should_create_stay_lifted_claimant_scenario() throws Exception {
jsonPath("$[1].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()),
jsonPath("$[1].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()),
jsonPath("$[2].reference").value(caseId),
jsonPath("$[2].taskNameEn").value("<a>Add the trial arrangements</a>"),
jsonPath("$[2].taskNameCy").value("<a>Ychwanegu trefniadau'r treial</a>"),
jsonPath("$[2].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()),
jsonPath("$[2].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()),
jsonPath("$[2].taskNameEn").value("<a href=\"{UPLOAD_HEARING_DOCUMENTS}\" class=\"govuk-link\">Upload hearing documents</a>"),
jsonPath("$[2].taskNameCy").value("<a href=\"{UPLOAD_HEARING_DOCUMENTS}\" class=\"govuk-link\">Llwytho dogfennau'r gwrandawiad</a>"),
jsonPath("$[2].currentStatusEn").value(TaskStatus.IN_PROGRESS.getName()),
jsonPath("$[2].currentStatusCy").value(TaskStatus.IN_PROGRESS.getWelshName()),
jsonPath("$[3].reference").value(caseId),
jsonPath("$[3].taskNameEn").value("<a>View the bundle</a>"),
jsonPath("$[3].taskNameCy").value("<a>Gweld y bwndel</a>"),
jsonPath("$[3].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()),
jsonPath("$[3].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName())
jsonPath("$[3].taskNameEn").value("<a href=\"{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}\" class=\"govuk-link\">View documents</a>"),
jsonPath("$[3].taskNameCy").value("<a href=\"{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}\" class=\"govuk-link\">Gweld y dogfennau</a>"),
jsonPath("$[3].currentStatusEn").value(TaskStatus.AVAILABLE.getName()),
jsonPath("$[3].currentStatusCy").value(TaskStatus.AVAILABLE.getWelshName()),
jsonPath("$[4].reference").value(caseId),
jsonPath("$[4].taskNameEn").value("<a>Add the trial arrangements</a>"),
jsonPath("$[4].taskNameCy").value("<a>Ychwanegu trefniadau'r treial</a>"),
jsonPath("$[4].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()),
jsonPath("$[4].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()),
jsonPath("$[5].reference").value(caseId),
jsonPath("$[5].taskNameEn").value("<a>View the bundle</a>"),
jsonPath("$[5].taskNameCy").value("<a>Gweld y bwndel</a>"),
jsonPath("$[5].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()),
jsonPath("$[5].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName())
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder;
import uk.gov.hmcts.reform.dashboard.data.TaskStatus;

import java.time.LocalDateTime;

import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
Expand All @@ -21,7 +23,7 @@ public class StayLiftedDefendantScenarioTest extends DashboardBaseIntegrationTes
private StayLiftedDefendantNotificationHandler handler;

@Test
void should_create_stay_lifted_claimant_scenario() throws Exception {
void should_create_stay_lifted_defendant_scenario() throws Exception {

String caseId = "7123454456455465";

Expand All @@ -31,6 +33,7 @@ void should_create_stay_lifted_claimant_scenario() throws Exception {
.ccdState(CaseState.CASE_PROGRESSION)
.preStayState(CaseState.HEARING_READINESS.toString())
.respondent1Represented(YesOrNo.NO)
.caseDocumentUploadDateRes(LocalDateTime.now())
.build();

when(featureToggleService.isLipVLipEnabled()).thenReturn(true);
Expand Down Expand Up @@ -59,15 +62,26 @@ void should_create_stay_lifted_claimant_scenario() throws Exception {
jsonPath("$[0].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()),
jsonPath("$[0].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()),
jsonPath("$[1].reference").value(caseId),
jsonPath("$[1].taskNameEn").value("<a>Add the trial arrangements</a>"),
jsonPath("$[1].taskNameCy").value("<a>Ychwanegu trefniadau'r treial</a>"),
jsonPath("$[1].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()),
jsonPath("$[1].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()),
jsonPath("$[1].taskNameEn").value("<a href=\"{UPLOAD_HEARING_DOCUMENTS}\" class=\"govuk-link\">Upload hearing documents</a>"),
jsonPath("$[1].taskNameCy").value("<a href=\"{UPLOAD_HEARING_DOCUMENTS}\" class=\"govuk-link\">Llwytho dogfennau'r gwrandawiad</a>"),
jsonPath("$[1].currentStatusEn").value(TaskStatus.IN_PROGRESS.getName()),
jsonPath("$[1].currentStatusCy").value(TaskStatus.IN_PROGRESS.getWelshName()),
jsonPath("$[2].reference").value(caseId),
jsonPath("$[2].reference").value(caseId),
jsonPath("$[2].taskNameEn").value("<a>View the bundle</a>"),
jsonPath("$[2].taskNameCy").value("<a>Gweld y bwndel</a>"),
jsonPath("$[2].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()),
jsonPath("$[2].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName())
jsonPath("$[2].taskNameEn").value("<a href=\"{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}\" class=\"govuk-link\">View documents</a>"),
jsonPath("$[2].taskNameCy").value("<a href=\"{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}\" class=\"govuk-link\">Gweld y dogfennau</a>"),
jsonPath("$[2].currentStatusEn").value(TaskStatus.AVAILABLE.getName()),
jsonPath("$[2].currentStatusCy").value(TaskStatus.AVAILABLE.getWelshName()),
jsonPath("$[3].reference").value(caseId),
jsonPath("$[3].taskNameEn").value("<a>Add the trial arrangements</a>"),
jsonPath("$[3].taskNameCy").value("<a>Ychwanegu trefniadau'r treial</a>"),
jsonPath("$[3].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()),
jsonPath("$[3].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()),
jsonPath("$[4].reference").value(caseId),
jsonPath("$[4].taskNameEn").value("<a>View the bundle</a>"),
jsonPath("$[4].taskNameCy").value("<a>Gweld y bwndel</a>"),
jsonPath("$[4].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()),
jsonPath("$[4].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName())
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ public enum DashboardScenarios {
SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK("Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Fee.Paid.Task"),
SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT("Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Claimant"),
SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT("Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Defendant"),
SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_CLAIMANT("Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Available.Claimant"),
SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT("Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Not.Available.Claimant"),
SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_DEFENDANT("Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Available.Defendant"),
SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_DEFENDANT("Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Not.Available.Defendant"),
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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import uk.gov.hmcts.reform.civil.callback.CaseEventsDashboardCallbackHandler;
import uk.gov.hmcts.reform.civil.client.DashboardApiClient;
import uk.gov.hmcts.reform.civil.enums.CaseState;
import uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
Expand All @@ -14,12 +15,15 @@
import java.util.List;
import java.util.Map;

import static java.util.Objects.nonNull;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_STAY_LIFTED_CLAIMANT;
import static uk.gov.hmcts.reform.civil.enums.CaseState.HEARING_READINESS;
import static uk.gov.hmcts.reform.civil.enums.CaseState.PREPARE_FOR_HEARING_CONDUCT_HEARING;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_CLAIMANT;

@Service
public class StayLiftedClaimantNotificationHandler extends CaseEventsDashboardCallbackHandler {
Expand Down Expand Up @@ -55,7 +59,8 @@ public Map<String, Boolean> getScenarios(CaseData caseData) {
return Map.of(
SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT.getScenario(), true,
SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT.getScenario(), hadHearingScheduled(caseData),
SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK.getScenario(), hadHearingScheduled(caseData) && !caseData.isHearingFeePaid()
SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK.getScenario(), hadHearingScheduled(caseData) && !caseData.isHearingFeePaid(),
getViewDocumentsScenario(caseData).getScenario(), true
);
}

Expand All @@ -69,4 +74,10 @@ private boolean hadHearingScheduled(CaseData caseData) {
).contains(CaseState.valueOf(caseData.getPreStayState()));
}

private DashboardScenarios getViewDocumentsScenario(CaseData caseData) {
return nonNull(caseData.getCaseDocumentUploadDate())
? SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_CLAIMANT
: SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import uk.gov.hmcts.reform.civil.callback.CaseEventsDashboardCallbackHandler;
import uk.gov.hmcts.reform.civil.client.DashboardApiClient;
import uk.gov.hmcts.reform.civil.enums.CaseState;
import uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
Expand All @@ -14,11 +15,14 @@
import java.util.List;
import java.util.Map;

import static java.util.Objects.nonNull;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_STAY_LIFTED_DEFENDANT;
import static uk.gov.hmcts.reform.civil.enums.CaseState.HEARING_READINESS;
import static uk.gov.hmcts.reform.civil.enums.CaseState.PREPARE_FOR_HEARING_CONDUCT_HEARING;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_DEFENDANT;

@Service
public class StayLiftedDefendantNotificationHandler extends CaseEventsDashboardCallbackHandler {
Expand Down Expand Up @@ -53,7 +57,9 @@ public Map<String, Boolean> getScenarios(CaseData caseData) {
if (caseData.isRespondent1NotRepresented()) {
return Map.of(
SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT.getScenario(), true,
SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT.getScenario(), hadHearingScheduled(caseData));
SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT.getScenario(), hadHearingScheduled(caseData),
getViewDocumentsScenario(caseData).getScenario(), true
);
}

return new HashMap<>();
Expand All @@ -65,4 +71,11 @@ private boolean hadHearingScheduled(CaseData caseData) {
PREPARE_FOR_HEARING_CONDUCT_HEARING
).contains(CaseState.valueOf(caseData.getPreStayState()));
}

private DashboardScenarios getViewDocumentsScenario(CaseData caseData) {
return nonNull(caseData.getCaseDocumentUploadDateRes())
? SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_DEFENDANT
: SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_DEFENDANT;
}

}

This file was deleted.

Loading

0 comments on commit 1d16311

Please sign in to comment.