diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/GenerateDirectionOrderCallbackHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/GenerateDirectionOrderCallbackHandler.java index d8272695a65..877a60ee0f6 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/GenerateDirectionOrderCallbackHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/GenerateDirectionOrderCallbackHandler.java @@ -61,7 +61,6 @@ import static uk.gov.hmcts.reform.civil.callback.CaseEvent.GENERATE_ORDER_NOTIFICATION; import static uk.gov.hmcts.reform.civil.enums.CaseState.All_FINAL_ORDERS_ISSUED; import static uk.gov.hmcts.reform.civil.enums.CaseState.CASE_PROGRESSION; -import static uk.gov.hmcts.reform.civil.enums.CaseState.JUDICIAL_REFERRAL; import static uk.gov.hmcts.reform.civil.enums.MultiPartyScenario.ONE_V_TWO_ONE_LEGAL_REP; import static uk.gov.hmcts.reform.civil.enums.MultiPartyScenario.ONE_V_TWO_TWO_LEGAL_REP; import static uk.gov.hmcts.reform.civil.enums.MultiPartyScenario.TWO_V_ONE; @@ -240,12 +239,8 @@ private DynamicList getLocationsFromList(final List locations) } private DynamicList populateCurrentHearingLocation(CaseData caseData, String authorisation) { - LocationRefData locationRefData; - if (hasSDOBeenMade(caseData.getCcdState())) { - locationRefData = locationHelper.getHearingLocation(null, caseData, authorisation); - } else { - locationRefData = locationRefDataService.getCcmccLocation(authorisation); - } + LocationRefData locationRefData = locationHelper.getHearingLocation(null, caseData, authorisation); + return DynamicList.builder().listItems(List.of(DynamicListElement.builder() .code("LOCATION_LIST") .label(locationRefData.getSiteName()) @@ -261,10 +256,6 @@ private DynamicList populateCurrentHearingLocation(CaseData caseData, String aut .build(); } - private boolean hasSDOBeenMade(CaseState state) { - return !JUDICIAL_REFERRAL.equals(state); - } - private CaseData.CaseDataBuilder populateFields( CaseData.CaseDataBuilder builder, List locations, CaseData caseData, String authToken) { LocalDate advancedDate = LocalDate.now().plusDays(14); diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/docmosis/caseprogression/JudgeFinalOrderGenerator.java b/src/main/java/uk/gov/hmcts/reform/civil/service/docmosis/caseprogression/JudgeFinalOrderGenerator.java index 5cb0d666df3..37d42ea87d4 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/docmosis/caseprogression/JudgeFinalOrderGenerator.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/docmosis/caseprogression/JudgeFinalOrderGenerator.java @@ -7,7 +7,6 @@ import uk.gov.hmcts.reform.civil.documentmanagement.model.CaseDocument; import uk.gov.hmcts.reform.civil.documentmanagement.model.DocumentType; import uk.gov.hmcts.reform.civil.documentmanagement.model.PDF; -import uk.gov.hmcts.reform.civil.enums.CaseState; import uk.gov.hmcts.reform.civil.enums.finalorders.ApplicationAppealList; import uk.gov.hmcts.reform.civil.enums.finalorders.CostEnums; import uk.gov.hmcts.reform.civil.enums.finalorders.FinalOrderToggle; @@ -35,7 +34,6 @@ import static java.lang.String.format; import static java.util.Objects.nonNull; -import static uk.gov.hmcts.reform.civil.enums.CaseState.JUDICIAL_REFERRAL; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES; import static uk.gov.hmcts.reform.civil.enums.caseprogression.FinalOrderSelection.FREE_FORM_ORDER; import static uk.gov.hmcts.reform.civil.enums.finalorders.AppealList.OTHER; @@ -97,13 +95,7 @@ private JudgeFinalOrderForm getFinalOrderType(CaseData caseData, String authoris private JudgeFinalOrderForm getFreeFormOrder(CaseData caseData, String authorisation) { UserDetails userDetails = idamClient.getUserDetails(authorisation); - LocationRefData locationRefData; - - if (hasSDOBeenMade(caseData.getCcdState())) { - locationRefData = locationHelper.getHearingLocation(null, caseData, authorisation); - } else { - locationRefData = locationRefDataService.getCcmccLocation(authorisation); - } + LocationRefData locationRefData = locationRefDataService.getCcmccLocation(authorisation); var freeFormOrderBuilder = JudgeFinalOrderForm.builder() .caseNumber(caseData.getCcdCaseReference().toString()) @@ -135,13 +127,8 @@ private JudgeFinalOrderForm getFreeFormOrder(CaseData caseData, String authorisa private JudgeFinalOrderForm getAssistedOrder(CaseData caseData, String authorisation) { UserDetails userDetails = idamClient.getUserDetails(authorisation); - LocationRefData locationRefData; + LocationRefData locationRefData = locationRefDataService.getCcmccLocation(authorisation); - if (hasSDOBeenMade(caseData.getCcdState())) { - locationRefData = locationHelper.getHearingLocation(null, caseData, authorisation); - } else { - locationRefData = locationRefDataService.getCcmccLocation(authorisation); - } var assistedFormOrderBuilder = JudgeFinalOrderForm.builder() .caseNumber(caseData.getCcdCaseReference().toString()) .claimant1Name(caseData.getApplicant1().getPartyName()) @@ -457,10 +444,6 @@ private String getOtherLength(CaseData caseData) { return otherLength.toString(); } - private boolean hasSDOBeenMade(CaseState state) { - return !JUDICIAL_REFERRAL.equals(state); - } - public String orderMadeDateBuilder(CaseData caseData) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.ENGLISH); if (caseData.getFinalOrderDateHeardComplex() != null) { diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/GenerateDirectionOrderCallbackHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/GenerateDirectionOrderCallbackHandlerTest.java index ab8fb8e8334..f4405df2cfd 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/GenerateDirectionOrderCallbackHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/GenerateDirectionOrderCallbackHandlerTest.java @@ -66,7 +66,6 @@ import static uk.gov.hmcts.reform.civil.callback.CaseEvent.GENERATE_DIRECTIONS_ORDER; import static uk.gov.hmcts.reform.civil.documentmanagement.model.DocumentType.JUDGE_FINAL_ORDER; import static uk.gov.hmcts.reform.civil.enums.CaseState.CASE_PROGRESSION; -import static uk.gov.hmcts.reform.civil.enums.CaseState.JUDICIAL_REFERRAL; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES; import static uk.gov.hmcts.reform.civil.enums.finalorders.FinalOrdersClaimantRepresentationList.CLAIMANT_NOT_ATTENDING; @@ -334,84 +333,8 @@ void shouldPopulateFields_whenIsCalledAfterSdoDiffSol() { .isEqualTo("Mr. John Rambo"); } - - @Test - void shouldPopulateFields_whenIsCalledBeforeSdo() { - // Given - CaseData caseData = CaseDataBuilder.builder().atStateNotificationAcknowledged().build().toBuilder() - .addApplicant2(YES) - .applicant2(PartyBuilder.builder().individual().build()) - .ccdState(JUDICIAL_REFERRAL) - .finalOrderSelection(FinalOrderSelection.ASSISTED_ORDER).build(); - List locations = new ArrayList<>(); - locations.add(LocationRefData.builder().courtName("Court Name").region("Region").build()); - when(locationRefDataService.getCourtLocationsForDefaultJudgments(any())).thenReturn(locations); - CallbackParams params = callbackParamsOf(caseData, MID, PAGE_ID); - String advancedDate = LocalDate.now().plusDays(14).toString(); - when(locationRefDataService.getCcmccLocation(any())).thenReturn(locationRefDataBeforeSdo); - // When - var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params); - // Then - assertThat(response.getData()).extracting("orderMadeOnDetailsOrderCourt") - .extracting("ownInitiativeText") - .isEqualTo(ON_INITIATIVE_SELECTION_TEXT); - assertThat(response.getData()).extracting("finalOrderRepresentation") - .extracting("typeRepresentationComplex") - .extracting("typeRepresentationClaimantOneDynamic") - .isEqualTo("Mr. John Rambo"); - assertThat(response.getData()).extracting("finalOrderRepresentation") - .extracting("typeRepresentationComplex") - .extracting("typeRepresentationDefendantOneDynamic") - .isEqualTo("Mr. Sole Trader"); - assertThat(response.getData()).extracting("finalOrderRepresentation") - .extracting("typeRepresentationComplex") - .extracting("typeRepresentationClaimantTwoDynamic") - .isEqualTo("Mr. John Rambo"); - assertThat(response.getData()).extracting("orderMadeOnDetailsOrderCourt") - .extracting("ownInitiativeDate") - .isEqualTo(LocalDate.now().plusDays(7).toString()); - assertThat(response.getData()).extracting("orderMadeOnDetailsOrderWithoutNotice") - .extracting("withOutNoticeText") - .isEqualTo(WITHOUT_NOTICE_SELECTION_TEXT); - assertThat(response.getData()).extracting("orderMadeOnDetailsOrderWithoutNotice") - .extracting("withOutNoticeDate") - .isEqualTo(LocalDate.now().plusDays(7).toString()); - assertThat(response.getData()).extracting("assistedOrderMakeAnOrderForCosts") - .extracting("assistedOrderCostsFirstDropdownDate") - .isEqualTo(advancedDate); - assertThat(response.getData()).extracting("assistedOrderMakeAnOrderForCosts") - .extracting("assistedOrderAssessmentThirdDropdownDate") - .isEqualTo(advancedDate); - assertThat(response.getData()).extracting("assistedOrderMakeAnOrderForCosts") - .extracting("makeAnOrderForCostsQOCSYesOrNo") - .isEqualTo("No"); - assertThat(response.getData()).extracting("publicFundingCostsProtection") - .isEqualTo("No"); - assertThat(response.getData()).extracting("finalOrderAppealComplex") - .extracting("appealGrantedDropdown") - .extracting("appealChoiceSecondDropdownA") - .extracting("appealGrantedRefusedDate") - .isEqualTo(LocalDate.now().plusDays(21).toString()); - assertThat(response.getData()).extracting("finalOrderAppealComplex") - .extracting("appealGrantedDropdown") - .extracting("appealChoiceSecondDropdownB") - .extracting("appealGrantedRefusedDate") - .isEqualTo(LocalDate.now().plusDays(21).toString()); - assertThat(response.getData()).extracting("finalOrderAppealComplex") - .extracting("appealRefusedDropdown") - .extracting("appealChoiceSecondDropdownA") - .extracting("appealGrantedRefusedDate") - .isEqualTo(LocalDate.now().plusDays(21).toString()); - assertThat(response.getData()).extracting("finalOrderAppealComplex") - .extracting("appealRefusedDropdown") - .extracting("appealChoiceSecondDropdownB") - .extracting("appealGrantedRefusedDate") - .isEqualTo(LocalDate.now().plusDays(21).toString()); - assertThat(response.getData()).extracting("finalOrderFurtherHearingComplex") - .extracting("hearingLocationList").asString().contains("SiteName before Sdo"); - } } - + @Nested class MidEventValidateAndGenerateOrderDocumentPreview { private static final String PAGE_ID = "validate-and-generate-document"; diff --git a/src/test/java/uk/gov/hmcts/reform/civil/service/docmosis/caseprogression/JudgeFinalOrderGeneratorTest.java b/src/test/java/uk/gov/hmcts/reform/civil/service/docmosis/caseprogression/JudgeFinalOrderGeneratorTest.java index 4ef4e6dc643..4df8a53ee4d 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/service/docmosis/caseprogression/JudgeFinalOrderGeneratorTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/service/docmosis/caseprogression/JudgeFinalOrderGeneratorTest.java @@ -212,7 +212,7 @@ void shouldGenerateFreeFormOrder_whenOrderWithoutNoticeIsSelected() { .thenReturn(FREE_FROM_ORDER); CaseData caseData = CaseDataBuilder.builder().atStateNotificationAcknowledged().build().toBuilder() .finalOrderSelection(FinalOrderSelection.FREE_FORM_ORDER) - .ccdState(CaseState.JUDICIAL_REFERRAL) + .ccdState(CaseState.CASE_PROGRESSION) .orderWithoutNotice(FreeFormOrderValues.builder().withoutNoticeSelectionTextArea("test without notice") .withoutNoticeSelectionDate(LocalDate.now()).build()) .respondent2(PartyBuilder.builder().individual().build().toBuilder() @@ -241,7 +241,7 @@ void shouldGenerateAssistedFormOrder_whenOptionalSectionsNotPresent() { .thenReturn(ASSISTED_FROM_ORDER); CaseData caseData = CaseDataBuilder.builder().atStateNotificationAcknowledged().build().toBuilder() - .ccdState(CaseState.JUDICIAL_REFERRAL) + .ccdState(CaseState.CASE_PROGRESSION) .finalOrderSelection(FinalOrderSelection.ASSISTED_ORDER) // Order made section .finalOrderMadeSelection(NO) @@ -288,7 +288,7 @@ void shouldGenerateAssistedFormOrder_whenOtherOptions() { .thenReturn(ASSISTED_FROM_ORDER); CaseData caseData = CaseDataBuilder.builder().atStateNotificationAcknowledged().build().toBuilder() - .ccdState(CaseState.JUDICIAL_REFERRAL) + .ccdState(CaseState.CASE_PROGRESSION) .finalOrderSelection(FinalOrderSelection.ASSISTED_ORDER) // Order made section .finalOrderDateHeardComplex(OrderMade.builder().singleDateSelection(DatesFinalOrders.builder().singleDate(