diff --git a/build.gradle b/build.gradle index 4e3e34584ab..6cafd03022c 100644 --- a/build.gradle +++ b/build.gradle @@ -355,10 +355,9 @@ dependencies { implementation group: 'com.mchange', name: 'c3p0', version: '0.10.1' implementation group: 'org.flywaydb', name: 'flyway-core', version: '9.22.3' - implementation group: 'com.github.hmcts', name: 'sscs-common', version: '5.12.17' + implementation group: 'com.github.hmcts', name: 'sscs-common', version: '5.12.18' implementation group: 'com.github.hmcts', name: 'sscs-pdf-email-common', version: '5.2.18' - implementation group: 'com.azure', name: 'azure-core', version: '1.46.0' implementation group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.15.1' diff --git a/definitions/benefit/sheets/CaseField/CaseField.json b/definitions/benefit/sheets/CaseField/CaseField.json index 7c73010464f..8576d92f954 100644 --- a/definitions/benefit/sheets/CaseField/CaseField.json +++ b/definitions/benefit/sheets/CaseField/CaseField.json @@ -129,6 +129,7 @@ {"LiveFrom": "20/08/2019", "CaseTypeID": "Benefit", "ID": "summaryRole", "Label": "**Role** \r\n${appeal.appellant.role.name}", "FieldType": "Label", "SecurityClassification": "PUBLIC"}, {"LiveFrom": "20/08/2019", "CaseTypeID": "Benefit", "ID": "summaryRoleDescription", "Label": "**Role Description** \r\n${appeal.appellant.role.description}", "FieldType": "Label", "SecurityClassification": "PUBLIC"}, {"LiveFrom": "20/08/2019", "CaseTypeID": "Benefit", "ID": "summaryDOB", "Label": "**Date of birth** \r\n${appeal.appellant.identity.dob}", "FieldType": "Label", "SecurityClassification": "PUBLIC"}, + {"LiveFrom": "20/08/2019", "CaseTypeID": "Benefit", "ID": "summaryIbcaReference", "Label": "**IBCA Reference** \r\n${appeal.appellant.identity.ibcaReference}", "FieldType": "Label", "SecurityClassification": "PUBLIC"}, {"LiveFrom": "20/08/2019", "CaseTypeID": "Benefit", "ID": "summaryBenefitType", "Label": "**Benefit type** \r\n${appeal.benefitType.description}", "FieldType": "Label", "SecurityClassification": "PUBLIC"}, {"LiveFrom": "20/08/2019", "CaseTypeID": "Benefit", "ID": "summaryAppealType", "Label": "**Appeal type** \r\n${appeal.benefitType.description}", "FieldType": "Label", "SecurityClassification": "PUBLIC"}, {"LiveFrom": "20/08/2019", "CaseTypeID": "Benefit", "ID": "summaryCaseReference", "Label": "**SC number** \r\n${caseReference}", "FieldType": "Label", "SecurityClassification": "PUBLIC"}, @@ -515,6 +516,5 @@ {"LiveFrom": "01/01/2018", "CaseTypeID": "Benefit", "ID": "judgeReserved", "Label": "Reserve to Judge?", "FieldType": "YesOrNo", "SecurityClassification": "PUBLIC"}, {"LiveFrom": "01/01/2018", "CaseTypeID": "Benefit", "ID": "tribunalDirectPoToAttend", "Label": "Tribunal direct PO to attend?", "FieldType": "YesOrNo", "SecurityClassification": "PUBLIC"}, {"LiveFrom": "06/02/2024", "CaseTypeID": "Benefit", "ID": "preWorkAllocation", "Label": "Case created before WA went Live", "FieldType": "YesOrNo", "SecurityClassification": "PUBLIC"}, - {"LiveFrom": "07/08/2024", "CaseTypeID": "Benefit", "ID": "ignoreCallbackWarnings", "Label": "Ignore callback warnings", "FieldType": "YesOrNo", "SecurityClassification": "PUBLIC"}, - {"LiveFrom": "20/08/2019", "CaseTypeID": "Benefit", "ID": "summaryIbcaReference", "Label": "**IBCA Reference** \r\n${appeal.appellant.identity.ibcaReference}", "FieldType": "Label", "SecurityClassification": "PUBLIC"} + {"LiveFrom": "07/08/2024", "CaseTypeID": "Benefit", "ID": "ignoreCallbackWarnings", "Label": "Ignore callback warnings", "FieldType": "YesOrNo", "SecurityClassification": "PUBLIC"} ] diff --git a/src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToStartHandler.java b/src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToStartHandler.java index 9bb3a562cfc..b8bb708c07b 100644 --- a/src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToStartHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToStartHandler.java @@ -7,6 +7,7 @@ import static uk.gov.hmcts.reform.sscs.ccd.domain.YesNo.isYes; import static uk.gov.hmcts.reform.sscs.ccd.presubmit.directionissued.ExtensionNextEventItemList.*; import static uk.gov.hmcts.reform.sscs.helper.SscsHelper.getPreValidStates; +import static uk.gov.hmcts.reform.sscs.model.AppConstants.BENEFIT_CODES_FOR_ISSUE_AND_SEND_TO_ADMIN; import java.util.ArrayList; import java.util.List; @@ -65,6 +66,10 @@ private void setDirectionTypeDropDown(SscsCaseData sscsCaseData) { listOptions.add(new DynamicListItem(APPEAL_TO_PROCEED.toString(), APPEAL_TO_PROCEED.getLabel())); listOptions.add(new DynamicListItem(PROVIDE_INFORMATION.toString(), PROVIDE_INFORMATION.getLabel())); + if (sscsCaseData.getBenefitCode() != null && BENEFIT_CODES_FOR_ISSUE_AND_SEND_TO_ADMIN.contains(sscsCaseData.getBenefitCode())) { + listOptions.add(new DynamicListItem(ISSUE_AND_SEND_TO_ADMIN.toString(), ISSUE_AND_SEND_TO_ADMIN.getLabel())); + } + if (isYes(sscsCaseData.getSscsHearingRecordingCaseData().getHearingRecordingRequestOutstanding())) { listOptions.add(new DynamicListItem(REFUSE_HEARING_RECORDING_REQUEST.toString(), REFUSE_HEARING_RECORDING_REQUEST.getLabel())); } diff --git a/src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToSubmitHandler.java b/src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToSubmitHandler.java index fa94228947a..d9b2dd03790 100644 --- a/src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToSubmitHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToSubmitHandler.java @@ -167,6 +167,8 @@ private SscsCaseData updateCaseForDirectionType(CaseDetails caseDe } else if (DirectionType.REFUSE_HEARING_RECORDING_REQUEST.toString().equals(caseData.getDirectionTypeDl().getValue().getCode())) { caseData.setInterlocReviewState(AWAITING_ADMIN_ACTION); caseData.setInterlocReferralReason(REJECT_HEARING_RECORDING_REQUEST); + } else if (DirectionType.ISSUE_AND_SEND_TO_ADMIN.toString().equals(caseData.getDirectionTypeDl().getValue().getCode())) { + caseData.setInterlocReviewState(AWAITING_ADMIN_ACTION); } else { caseData.setInterlocReviewState(null); } diff --git a/src/main/java/uk/gov/hmcts/reform/sscs/model/AppConstants.java b/src/main/java/uk/gov/hmcts/reform/sscs/model/AppConstants.java index a9c8aa64d30..18c17a0c49c 100644 --- a/src/main/java/uk/gov/hmcts/reform/sscs/model/AppConstants.java +++ b/src/main/java/uk/gov/hmcts/reform/sscs/model/AppConstants.java @@ -1,5 +1,8 @@ package uk.gov.hmcts.reform.sscs.model; +import java.util.List; +import java.util.Objects; + public class AppConstants { public static final String ADDRESS_LINE_1 = "addressLine1"; @@ -37,7 +40,7 @@ public class AppConstants { public static final String DWP_DOCUMENT_EDITED_RESPONSE_FILENAME_PREFIX = "FTA edited response received"; public static final String DWP_DOCUMENT_EDITED_EVIDENCE_FILENAME_PREFIX = "FTA edited evidence received"; public static final String DATE_FORMAT_YYYYMMDD = "yyyy-MM-dd"; - + public static final List BENEFIT_CODES_FOR_ISSUE_AND_SEND_TO_ADMIN = Objects.equals(System.getenv("INFECTED_BLOOD_COMPENSATION_ENABLED"), "true") ? List.of("093", "016", "022") : List.of("093"); public static final String IBCA_BENEFIT_CODE = "093"; public static final String INFECTED_BLOOD_COMPENSATION = "infectedBloodCompensation"; public static final int FUNCTIONAL_FETCH_ATTEMPTS = 5; diff --git a/src/test/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToStartHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToStartHandlerTest.java index d66d74de3f8..bce7fe78b00 100644 --- a/src/test/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToStartHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToStartHandlerTest.java @@ -9,6 +9,7 @@ import static uk.gov.hmcts.reform.sscs.ccd.domain.YesNo.NO; import static uk.gov.hmcts.reform.sscs.ccd.domain.YesNo.YES; import static uk.gov.hmcts.reform.sscs.ccd.presubmit.directionissued.ExtensionNextEventItemList.*; +import static uk.gov.hmcts.reform.sscs.model.AppConstants.BENEFIT_CODES_FOR_ISSUE_AND_SEND_TO_ADMIN; import java.util.ArrayList; import java.util.Collections; @@ -81,7 +82,7 @@ public void givenValidAppeal_populateExtensionNextEventDropdown() { listOptions.add(new DynamicListItem(NO_FURTHER_ACTION.getCode(), NO_FURTHER_ACTION.getLabel())); DynamicList expected = new DynamicList(new DynamicListItem("", ""), listOptions); assertEquals(expected, response.getData().getExtensionNextEventDl()); - assertEquals(2, listOptions.size()); + assertEquals(2, response.getData().getExtensionNextEventDl().getListItems().size()); } @Test @@ -99,7 +100,7 @@ public void givenValidAppealWithExtensionNextEventDropdownAlreadyPopulated_thenA DynamicList expected = new DynamicList(new DynamicListItem(NO_FURTHER_ACTION.getCode(), NO_FURTHER_ACTION.getCode()), listOptions); assertEquals(expected, response.getData().getExtensionNextEventDl()); - assertEquals(2, listOptions.size()); + assertEquals(2, response.getData().getExtensionNextEventDl().getListItems().size()); } @Test @@ -117,7 +118,7 @@ public void givenNonValidAppeal_populateExtensionNextEventDropdown(State state) DynamicList expected = new DynamicList(new DynamicListItem("", ""), listOptions); assertEquals(expected, response.getData().getExtensionNextEventDl()); - assertEquals(3, listOptions.size()); + assertEquals(3, response.getData().getExtensionNextEventDl().getListItems().size()); } @Test @@ -136,7 +137,42 @@ public void givenAppealWithTimeExtension_populateDirectionTypeDropdown() { DynamicList expected = new DynamicList(new DynamicListItem("", ""), listOptions); assertEquals(expected, response.getData().getDirectionTypeDl()); - assertEquals(4, listOptions.size()); + assertEquals(4, response.getData().getDirectionTypeDl().getListItems().size()); + } + + @Test + public void givenSpecificBenefitCodeAppeal_populateDirectionTypeDropdown() { + for (String benefitCode : BENEFIT_CODES_FOR_ISSUE_AND_SEND_TO_ADMIN) { + when(callback.getEvent()).thenReturn(EventType.DIRECTION_ISSUED); + sscsCaseData.setBenefitCode(benefitCode); + + List listOptions = new ArrayList<>(); + listOptions.add(new DynamicListItem(APPEAL_TO_PROCEED.toString(), APPEAL_TO_PROCEED.getLabel())); + listOptions.add(new DynamicListItem(PROVIDE_INFORMATION.toString(), PROVIDE_INFORMATION.getLabel())); + listOptions.add(new DynamicListItem(ISSUE_AND_SEND_TO_ADMIN.toString(), ISSUE_AND_SEND_TO_ADMIN.getLabel())); + + PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_START, callback, USER_AUTHORISATION); + + DynamicList expected = new DynamicList(new DynamicListItem("", ""), listOptions); + assertEquals(expected, response.getData().getDirectionTypeDl()); + assertEquals(3, response.getData().getDirectionTypeDl().getListItems().size()); + } + } + + @Test + public void givenNonSpecificBenefitCodeAppeal_doNotPopulateIssueAndSendToAdmin() { + when(callback.getEvent()).thenReturn(EventType.DIRECTION_ISSUED); + sscsCaseData.setBenefitCode("001"); + + List listOptions = new ArrayList<>(); + listOptions.add(new DynamicListItem(APPEAL_TO_PROCEED.toString(), APPEAL_TO_PROCEED.getLabel())); + listOptions.add(new DynamicListItem(PROVIDE_INFORMATION.toString(), PROVIDE_INFORMATION.getLabel())); + + PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_START, callback, USER_AUTHORISATION); + + DynamicList expected = new DynamicList(new DynamicListItem("", ""), listOptions); + assertEquals(expected, response.getData().getDirectionTypeDl()); + assertEquals(2, response.getData().getDirectionTypeDl().getListItems().size()); } @Test @@ -157,7 +193,7 @@ public void givenAppealWithReinstatementRequest_populateDirectionTypeDropdown() DynamicList expected = new DynamicList(new DynamicListItem("", ""), listOptions); assertEquals(expected, response.getData().getDirectionTypeDl()); - assertEquals(4, listOptions.size()); + assertEquals(4, response.getData().getDirectionTypeDl().getListItems().size()); } @Test @@ -177,7 +213,7 @@ public void givenAppealWithUrgentHearingEnabledAndUrgentCaseYes_populateDirectio DynamicList expected = new DynamicList(new DynamicListItem("", ""), listOptions); assertEquals(expected, response.getData().getDirectionTypeDl()); - assertEquals(4, listOptions.size()); + assertEquals(4, response.getData().getDirectionTypeDl().getListItems().size()); } @Test @@ -195,7 +231,7 @@ public void givenAppealWithUrgentHearingEnabledAndUrgentCaseNo_populateDirection DynamicList expected = new DynamicList(new DynamicListItem("", ""), listOptions); assertEquals(expected, response.getData().getDirectionTypeDl()); - assertEquals(2, listOptions.size()); + assertEquals(2, response.getData().getDirectionTypeDl().getListItems().size()); } @Test @@ -216,7 +252,7 @@ public void givenValidAppealWithTimeExtensionAndDirectionTypeDropdownAlreadyPopu DynamicList expected = new DynamicList(new DynamicListItem(GRANT_EXTENSION.toString(), GRANT_EXTENSION.toString()), listOptions); assertEquals(expected, response.getData().getDirectionTypeDl()); - assertEquals(4, listOptions.size()); + assertEquals(4, response.getData().getDirectionTypeDl().getListItems().size()); } @Test @@ -232,7 +268,7 @@ public void givenAppealWithNoTimeExtension_populateDirectionTypeDropdown() { DynamicList expected = new DynamicList(new DynamicListItem("", ""), listOptions); assertEquals(expected, response.getData().getDirectionTypeDl()); - assertEquals(2, listOptions.size()); + assertEquals(2, response.getData().getDirectionTypeDl().getListItems().size()); } @Test @@ -251,7 +287,7 @@ public void givenAppealWithHearingRecordingRequestOutstanding_populateDirectionT PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_START, callback, USER_AUTHORISATION); DynamicList expected = new DynamicList(new DynamicListItem("", ""), listOptions); - assertEquals(3, listOptions.size()); + assertEquals(3, response.getData().getDirectionTypeDl().getListItems().size()); assertEquals(expected, response.getData().getDirectionTypeDl()); } @@ -270,7 +306,7 @@ public void givenAppealWithNoHearingRecordingRequestOutstanding_doNotPopulateDir PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_START, callback, USER_AUTHORISATION); DynamicList expected = new DynamicList(new DynamicListItem("", ""), listOptions); - assertEquals(2, listOptions.size()); + assertEquals(2, response.getData().getDirectionTypeDl().getListItems().size()); assertEquals(expected, response.getData().getDirectionTypeDl()); } diff --git a/src/test/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToSubmitHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToSubmitHandlerTest.java index 4d89a39ae8d..aad2f3210f4 100644 --- a/src/test/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToSubmitHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/directionissued/DirectionIssuedAboutToSubmitHandlerTest.java @@ -17,11 +17,11 @@ import static uk.gov.hmcts.reform.sscs.ccd.domain.YesNo.NO; import static uk.gov.hmcts.reform.sscs.ccd.domain.YesNo.YES; -import com.google.common.collect.ImmutableSet; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; import java.util.Optional; +import java.util.Set; import junitparams.JUnitParamsRunner; import junitparams.Parameters; import org.junit.Before; @@ -80,7 +80,7 @@ public class DirectionIssuedAboutToSubmitHandlerTest { private SscsWelshDocument expectedWelshDocument; @Mock - private PreSubmitCallbackResponse response; + private PreSubmitCallbackResponse mockedResponse; @Before public void setUp() { @@ -129,7 +129,7 @@ public void setUp() { when(caseDetails.getCaseData()).thenReturn(sscsCaseData); when(caseDetails.getState()).thenReturn(State.INTERLOCUTORY_REVIEW_STATE); when(caseDetailsBefore.getState()).thenReturn(State.INTERLOCUTORY_REVIEW_STATE); - when(response.getErrors()).thenReturn(emptySet()); + when(mockedResponse.getErrors()).thenReturn(emptySet()); when(dwpAddressLookupService.getDwpRegionalCenterByBenefitTypeAndOffice(anyString(), anyString())).thenReturn(DUMMY_REGIONAL_CENTER); when(dwpAddressLookupService.getDefaultDwpMappingByBenefitType(anyString())).thenReturn(Optional.of(OfficeMapping.builder().isDefault(true).mapping(Mapping.builder().ccd("DWP PIP (1)").build()).build())); @@ -267,7 +267,7 @@ public void givenDirectionTypeOfAppealToProceedAndCaseIsPreValidInterloc_setInte @Test public void givenDirectionTypeOfAppealToProceedAndCaseIsPreValidInterloc_willNotReturnValidationErrorsFromExternalService() { String errorMessage = "There was an error in the external service"; - when(response.getErrors()).thenReturn(ImmutableSet.of(errorMessage)); + when(mockedResponse.getErrors()).thenReturn(Set.of(errorMessage)); callback.getCaseDetails().getCaseData().setDirectionTypeDl(new DynamicList(DirectionType.APPEAL_TO_PROCEED.toString())); when(caseDetails.getState()).thenReturn(State.INTERLOCUTORY_REVIEW_STATE); PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_SUBMIT, callback, USER_AUTHORISATION); @@ -396,8 +396,8 @@ public void givenDirectionTypeOfGrantReinstatementAndNotInterlocReview_setState( callback.getCaseDetails().getCaseData().setDirectionTypeDl(new DynamicList(DirectionType.GRANT_REINSTATEMENT.toString())); PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_SUBMIT, callback, USER_AUTHORISATION); - assertTrue(response.getData().getState().equals(State.APPEAL_CREATED)); - assertTrue(response.getData().getReinstatementOutcome().equals(RequestOutcome.GRANTED)); + assertEquals(State.APPEAL_CREATED, response.getData().getState()); + assertEquals(RequestOutcome.GRANTED, response.getData().getReinstatementOutcome()); assertEquals(DwpState.REINSTATEMENT_GRANTED, response.getData().getDwpState()); assertNull(response.getData().getInterlocReviewState()); } @@ -414,9 +414,9 @@ public void givenDirectionTypeOfGrantReinstatementAndInterlocReview_setState() { callback.getCaseDetails().getCaseData().setDirectionTypeDl(new DynamicList(DirectionType.GRANT_REINSTATEMENT.toString())); PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_SUBMIT, callback, USER_AUTHORISATION); - assertTrue(response.getData().getState().equals(State.INTERLOCUTORY_REVIEW_STATE)); - assertTrue(response.getData().getReinstatementOutcome().equals(RequestOutcome.GRANTED)); - assertTrue(response.getData().getInterlocReviewState().equals(AWAITING_ADMIN_ACTION)); + assertEquals(State.INTERLOCUTORY_REVIEW_STATE, response.getData().getState()); + assertEquals(RequestOutcome.GRANTED, response.getData().getReinstatementOutcome()); + assertEquals(AWAITING_ADMIN_ACTION, response.getData().getInterlocReviewState()); assertEquals(DwpState.REINSTATEMENT_GRANTED, response.getData().getDwpState()); } @@ -432,8 +432,8 @@ public void givenDirectionTypeOfRefuseReinstatementkeepState() { callback.getCaseDetails().getCaseData().setDirectionTypeDl(new DynamicList(DirectionType.REFUSE_REINSTATEMENT.toString())); PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_SUBMIT, callback, USER_AUTHORISATION); - assertTrue(response.getData().getState().equals(State.DORMANT_APPEAL_STATE)); - assertTrue(response.getData().getReinstatementOutcome().equals(RequestOutcome.REFUSED)); + assertEquals(State.DORMANT_APPEAL_STATE, response.getData().getState()); + assertEquals(RequestOutcome.REFUSED, response.getData().getReinstatementOutcome()); assertNull(response.getData().getInterlocReviewState()); assertEquals(DwpState.REINSTATEMENT_REFUSED, response.getData().getDwpState()); } @@ -452,8 +452,8 @@ public void givenDirectionTypeOfGrantReinstatementForWelshCaseDont_setStates() { callback.getCaseDetails().getCaseData().setDirectionTypeDl(new DynamicList(DirectionType.GRANT_REINSTATEMENT.toString())); PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_SUBMIT, callback, USER_AUTHORISATION); - assertTrue(response.getData().getState().equals(State.DORMANT_APPEAL_STATE)); - assertTrue(response.getData().getReinstatementOutcome().equals(RequestOutcome.IN_PROGRESS)); + assertEquals(State.DORMANT_APPEAL_STATE, response.getData().getState()); + assertEquals(RequestOutcome.IN_PROGRESS, response.getData().getReinstatementOutcome()); assertEquals(DwpState.LAPSED, response.getData().getDwpState()); assertEquals(WELSH_TRANSLATION, response.getData().getInterlocReviewState()); assertEquals("Yes", response.getData().getTranslationWorkOutstanding()); @@ -473,8 +473,8 @@ public void givenDirectionTypeOfRefuseReinstatementForWelshCaseDont_setStates() callback.getCaseDetails().getCaseData().setDirectionTypeDl(new DynamicList(DirectionType.REFUSE_REINSTATEMENT.toString())); PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_SUBMIT, callback, USER_AUTHORISATION); - assertTrue(response.getData().getState().equals(State.DORMANT_APPEAL_STATE)); - assertTrue(response.getData().getReinstatementOutcome().equals(RequestOutcome.IN_PROGRESS)); + assertEquals(State.DORMANT_APPEAL_STATE, response.getData().getState()); + assertEquals(RequestOutcome.IN_PROGRESS, response.getData().getReinstatementOutcome()); assertEquals(DwpState.LAPSED, response.getData().getDwpState()); assertEquals(WELSH_TRANSLATION, response.getData().getInterlocReviewState()); assertEquals("Yes", response.getData().getTranslationWorkOutstanding()); @@ -492,9 +492,9 @@ public void givenDirectionTypeOfGrantUrgentHearingAndInterlocReview_setState() { callback.getCaseDetails().getCaseData().setDirectionTypeDl(new DynamicList(DirectionType.GRANT_URGENT_HEARING.toString())); PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_SUBMIT, callback, USER_AUTHORISATION); - assertTrue(response.getData().getState().equals(State.INTERLOCUTORY_REVIEW_STATE)); - assertTrue(response.getData().getUrgentHearingOutcome().equals(RequestOutcome.GRANTED.getValue())); - assertTrue(response.getData().getInterlocReviewState().equals(AWAITING_ADMIN_ACTION)); + assertEquals(State.INTERLOCUTORY_REVIEW_STATE, response.getData().getState()); + assertEquals(RequestOutcome.GRANTED.getValue(), response.getData().getUrgentHearingOutcome()); + assertEquals(AWAITING_ADMIN_ACTION, response.getData().getInterlocReviewState()); assertEquals(DIRECTION_ACTION_REQUIRED, response.getData().getDwpState()); } @@ -511,9 +511,9 @@ public void givenDirectionTypeOfRefuseUrgentHearingkeepState() { callback.getCaseDetails().getCaseData().setDirectionTypeDl(new DynamicList(DirectionType.REFUSE_URGENT_HEARING.toString())); PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_SUBMIT, callback, USER_AUTHORISATION); - assertTrue(response.getData().getState().equals(State.DORMANT_APPEAL_STATE)); - assertTrue(response.getData().getUrgentHearingOutcome().equals(RequestOutcome.REFUSED.getValue())); - assertTrue(response.getData().getInterlocReviewState().equals(NONE)); + assertEquals(State.DORMANT_APPEAL_STATE, response.getData().getState()); + assertEquals(RequestOutcome.REFUSED.getValue(), response.getData().getUrgentHearingOutcome()); + assertEquals(NONE, response.getData().getInterlocReviewState()); assertTrue("No".equalsIgnoreCase(response.getData().getUrgentCase())); assertEquals(DIRECTION_ACTION_REQUIRED, response.getData().getDwpState()); } @@ -528,12 +528,27 @@ public void givenDirectionTypeOfRefuseHearingRecordingRequest_setInterlocReviewS callback.getCaseDetails().getCaseData().setDirectionTypeDl(new DynamicList(DirectionType.REFUSE_HEARING_RECORDING_REQUEST.toString())); PreSubmitCallbackResponse response = handler.handle(ABOUT_TO_SUBMIT, callback, USER_AUTHORISATION); - assertTrue(response.getData().getState().equals(State.DORMANT_APPEAL_STATE)); - assertTrue(response.getData().getInterlocReviewState().equals(AWAITING_ADMIN_ACTION)); + assertEquals(State.DORMANT_APPEAL_STATE, response.getData().getState()); + assertEquals(AWAITING_ADMIN_ACTION, response.getData().getInterlocReviewState()); assertEquals(REJECT_HEARING_RECORDING_REQUEST, response.getData().getInterlocReferralReason()); assertEquals(DIRECTION_ACTION_REQUIRED, response.getData().getDwpState()); } + @Test + public void givenDirectionTypeOfIssueAndSendToAdmin_setInterlocReviewStateOnly() { + callback.getCaseDetails().getCaseData().setState(State.DORMANT_APPEAL_STATE); + callback.getCaseDetails().getCaseData().setReinstatementOutcome(RequestOutcome.IN_PROGRESS); + callback.getCaseDetails().getCaseData().setDwpState(DwpState.LAPSED); + + callback.getCaseDetails().getCaseData().setDirectionTypeDl(new DynamicList(DirectionType.ISSUE_AND_SEND_TO_ADMIN.toString())); + PreSubmitCallbackResponse res = handler.handle(ABOUT_TO_SUBMIT, callback, USER_AUTHORISATION); + + assertEquals(State.DORMANT_APPEAL_STATE, res.getData().getState()); + assertEquals(AWAITING_ADMIN_ACTION, res.getData().getInterlocReviewState()); + assertNull(res.getData().getInterlocReferralReason()); + assertEquals(DIRECTION_ACTION_REQUIRED, res.getData().getDwpState()); + } + @Test @Parameters({"file.png", "file.jpg", "file.doc"}) public void givenManuallyUploadedFileIsNotAPdf_thenAddAnErrorToResponse(String filename) {