From 6898f1961788f7a002f1296a6dad19da7e611466 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Thu, 14 Nov 2024 14:23:21 +0000 Subject: [PATCH 1/2] Move List for Hearing fields into wrapper class --- .../NocApplyDecisionConsumerTest.java | 2 +- .../HearingDatePopulatedValidator.java | 2 +- .../helper/DocumentHelper.java | 3 +- .../FinremNotificationRequestMapper.java | 6 +++- .../AdditionalHearingDetailsMapper.java | 8 ++--- .../formc/FormCLetterDetailsMapper.java | 10 +++--- .../formg/FormGLetterDetailsMapper.java | 4 +-- .../model/ccd/FinremCaseData.java | 20 ++++++----- .../ccd/wrapper/ListForHearingWrapper.java | 34 +++++++++++++++++++ .../AdditionalHearingDocumentService.java | 7 ++-- .../ApprovedOrderNoticeOfHearingService.java | 8 ++--- .../service/HearingService.java | 15 ++++---- .../service/ValidateHearingService.java | 4 +-- .../FinremAdditionalHearingCorresponder.java | 3 +- .../controller/helper/DocumentHelperTest.java | 2 +- ...ringContestedAboutToSubmitHandlerTest.java | 2 +- .../HearingDatePopulatedValidatorTest.java | 6 ++-- .../HearingNonFastTrackDocumentTest.java | 7 ++-- .../mapper/FinremCaseDetailMapperTest.java | 4 +-- .../FinremNotificationRequestMapperTest.java | 4 +-- .../formc/FormCLetterDetailsMapperTest.java | 8 ++--- .../formg/FormGLetterDetailsMapperTest.java | 6 ++-- .../AdditionalHearingDocumentServiceTest.java | 11 +++--- ...provedOrderNoticeOfHearingServiceTest.java | 6 ++-- .../service/HearingServiceTest.java | 32 +++++------------ .../service/ValidateHearingServiceTest.java | 20 +++++------ ...nremAdditionalHearingCorresponderTest.java | 4 +-- .../FinremFormCandGCorresponderTest.java | 7 ++-- .../HearingNoticesCategoriserTest.java | 5 ++- .../DuplicateFilenameDocumentCheckerTest.java | 13 ++++--- 30 files changed, 156 insertions(+), 107 deletions(-) create mode 100644 src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/wrapper/ListForHearingWrapper.java diff --git a/src/contractTests/java/uk/gov/hmcts/reform/finrem/caseorchestration/contracts/caseassignment/NocApplyDecisionConsumerTest.java b/src/contractTests/java/uk/gov/hmcts/reform/finrem/caseorchestration/contracts/caseassignment/NocApplyDecisionConsumerTest.java index 3ea07f6fa1..1c13b9412d 100644 --- a/src/contractTests/java/uk/gov/hmcts/reform/finrem/caseorchestration/contracts/caseassignment/NocApplyDecisionConsumerTest.java +++ b/src/contractTests/java/uk/gov/hmcts/reform/finrem/caseorchestration/contracts/caseassignment/NocApplyDecisionConsumerTest.java @@ -168,7 +168,7 @@ private Map createCaseData() { caseData.getContactDetailsWrapper().setRespondentLname("Respondent"); caseData.setDivorceCaseNumber("DD12D12345"); caseData.getRegionWrapper().getDefaultCourtList().setBristolCourtList(BristolCourt.BRISTOL_CIVIL_AND_FAMILY_JUSTICE_CENTRE); - caseData.setHearingDate(HEARING_DATE); + caseData.getListForHearingWrapper().setHearingDate(HEARING_DATE); caseData.getContactDetailsWrapper().setSolicitorReference("Test Sol Reference"); caseData.setChangeOrganisationRequestField(ChangeOrganisationRequest .builder() diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/hearingbundles/HearingDatePopulatedValidator.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/hearingbundles/HearingDatePopulatedValidator.java index 2ec2c32cc5..1572d519ae 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/hearingbundles/HearingDatePopulatedValidator.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/hearingbundles/HearingDatePopulatedValidator.java @@ -13,7 +13,7 @@ public class HearingDatePopulatedValidator { public List validateHearingDate(FinremCaseData finremCaseData) { List errors = new ArrayList<>(); - if (finremCaseData.getHearingDate() == null) { + if (finremCaseData.getListForHearingWrapper().getHearingDate() == null) { log.info("Hearing date for Case ID: {} not found", finremCaseData.getCcdCaseId()); errors.add("Missing hearing date."); } diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/helper/DocumentHelper.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/helper/DocumentHelper.java index c03b2acd5a..df4130a354 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/helper/DocumentHelper.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/helper/DocumentHelper.java @@ -429,7 +429,8 @@ public Optional getLatestAdditionalHearingDocument(Map getLatestAdditionalHearingDocument(FinremCaseData caseData) { - List additionalHearingDocuments = caseData.getAdditionalHearingDocuments(); + List additionalHearingDocuments = caseData.getListForHearingWrapper() + .getAdditionalHearingDocuments(); Optional documentCollection = ofNullable(additionalHearingDocuments) .orElse(emptyList()) diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/FinremNotificationRequestMapper.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/FinremNotificationRequestMapper.java index 7252d06784..6a0595e3f4 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/FinremNotificationRequestMapper.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/FinremNotificationRequestMapper.java @@ -11,6 +11,7 @@ import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.FinremCaseDetails; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.RepresentationUpdate; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.RepresentationUpdateHistoryCollection; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.ListForHearingWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.intevener.IntervenerDetails; import uk.gov.hmcts.reform.finrem.caseorchestration.model.notification.NotificationRequest; import uk.gov.hmcts.reform.finrem.caseorchestration.model.wrapper.SolicitorCaseDataKeysWrapper; @@ -133,7 +134,10 @@ private NotificationRequest buildNotificationRequest(FinremCaseDetails caseDetai log.info("selectedCourt is {} for case ID: {}", notificationRequest.getSelectedCourt(), notificationRequest.getCaseReferenceNumber()); } - notificationRequest.setHearingType(caseData.getHearingType() != null ? caseData.getHearingType().getId() : ""); + ListForHearingWrapper listForHearingWrapper = caseData.getListForHearingWrapper(); + notificationRequest.setHearingType(listForHearingWrapper.getHearingType() != null + ? listForHearingWrapper.getHearingType().getId() + : ""); notificationRequest.setIsNotDigital(caseDataKeysWrapper.getSolicitorIsNotDigitalKey()); return notificationRequest; diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/additionalhearing/AdditionalHearingDetailsMapper.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/additionalhearing/AdditionalHearingDetailsMapper.java index 2af19452db..585cfb7389 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/additionalhearing/AdditionalHearingDetailsMapper.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/additionalhearing/AdditionalHearingDetailsMapper.java @@ -32,11 +32,11 @@ public DocumentTemplateDetails buildDocumentTemplateDetails(FinremCaseDetails ca .courtAddress(courtDetails.getCourtAddress()) .courtEmail(courtDetails.getEmail()) .courtPhone(courtDetails.getPhoneNumber()) - .hearingDate(String.valueOf(caseDetails.getData().getHearingDate())) - .hearingType(caseDetails.getData().getHearingType().getId()) + .hearingDate(String.valueOf(caseDetails.getData().getListForHearingWrapper().getHearingDate())) + .hearingType(caseDetails.getData().getListForHearingWrapper().getHearingType().getId()) .hearingVenue(courtDetails.getCourtName()) - .hearingLength(caseDetails.getData().getTimeEstimate()) - .hearingTime(caseDetails.getData().getHearingTime()) + .hearingLength(caseDetails.getData().getListForHearingWrapper().getTimeEstimate()) + .hearingTime(caseDetails.getData().getListForHearingWrapper().getHearingTime()) .additionalHearingDated(new Date()) .build(); } diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formc/FormCLetterDetailsMapper.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formc/FormCLetterDetailsMapper.java index b461dd84aa..796ac27955 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formc/FormCLetterDetailsMapper.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formc/FormCLetterDetailsMapper.java @@ -7,6 +7,7 @@ import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.FinremCaseData; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.FinremCaseDetails; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.CourtListWrapper; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.ListForHearingWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.model.letterdetails.DocumentTemplateDetails; import uk.gov.hmcts.reform.finrem.caseorchestration.model.letterdetails.FormCLetterDetails; @@ -21,7 +22,8 @@ public FormCLetterDetailsMapper(CourtDetailsMapper courtDetailsMapper, ObjectMap @Override public DocumentTemplateDetails buildDocumentTemplateDetails(FinremCaseDetails caseDetails, CourtListWrapper courtList) { FinremCaseData caseData = caseDetails.getData(); - LocalDate hearingDate = caseData.getHearingDate(); + ListForHearingWrapper listForHearingWrapper = caseData.getListForHearingWrapper(); + LocalDate hearingDate = listForHearingWrapper.getHearingDate(); return FormCLetterDetails.builder() .applicantFmName(caseData.getContactDetailsWrapper().getApplicantFmName()) .applicantLName(caseData.getContactDetailsWrapper().getApplicantLname()) @@ -34,9 +36,9 @@ public DocumentTemplateDetails buildDocumentTemplateDetails(FinremCaseDetails ca .hearingDateLess14Days(String.valueOf(hearingDate.minusDays(14))) .solicitorReference(caseData.getContactDetailsWrapper().getSolicitorReference()) .respondentSolicitorReference(caseData.getContactDetailsWrapper().getRespondentSolicitorReference()) - .additionalInformationAboutHearing(caseData.getAdditionalInformationAboutHearing()) - .hearingTime(caseData.getHearingTime()) - .timeEstimate(caseData.getTimeEstimate()) + .additionalInformationAboutHearing(caseData.getListForHearingWrapper().getAdditionalInformationAboutHearing()) + .hearingTime(listForHearingWrapper.getHearingTime()) + .timeEstimate(listForHearingWrapper.getTimeEstimate()) .formCCreatedDate(String.valueOf(LocalDate.now())) .eventDatePlus21Days(String.valueOf(LocalDate.now().plusDays(21))) .build(); diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formg/FormGLetterDetailsMapper.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formg/FormGLetterDetailsMapper.java index 6d54260c60..ccc85af9a2 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formg/FormGLetterDetailsMapper.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formg/FormGLetterDetailsMapper.java @@ -26,10 +26,10 @@ public DocumentTemplateDetails buildDocumentTemplateDetails(FinremCaseDetails ca .respondentLName(caseData.getContactDetailsWrapper().getRespondentLname()) .divorceCaseNumber(caseData.getDivorceCaseNumber()) .courtDetails(courtDetailsMapper.getCourtDetails(courtList)) - .hearingDate(String.valueOf(caseData.getHearingDate())) + .hearingDate(String.valueOf(caseData.getListForHearingWrapper().getHearingDate())) .solicitorReference(caseData.getContactDetailsWrapper().getSolicitorReference()) .respondentSolicitorReference(caseData.getContactDetailsWrapper().getRespondentSolicitorReference()) - .hearingTime(caseData.getHearingTime()) + .hearingTime(caseData.getListForHearingWrapper().getHearingTime()) .build(); } } diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/FinremCaseData.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/FinremCaseData.java index 9499940de4..3934f13d88 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/FinremCaseData.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/FinremCaseData.java @@ -38,6 +38,7 @@ import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.IntervenerOne; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.IntervenerThree; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.IntervenerTwo; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.ListForHearingWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.MiamWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.NatureApplicationWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.OrderWrapper; @@ -226,19 +227,13 @@ public class FinremCaseData implements HasCaseDocument { private String familyMediatorServiceName1; private String soleTraderName1; private YesOrNo promptForAnyDocument; - private List additionalHearingDocuments; private List hearingDirectionDetailsCollection; private List hearingNoticeDocumentPack; private List hearingNoticesDocumentCollection; private Map courtDetails; - - private HearingTypeDirection hearingType; - private String timeEstimate; - @JsonSerialize(using = LocalDateSerializer.class) - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") - private LocalDate hearingDate; - private String additionalInformationAboutHearing; - private String hearingTime; + @JsonUnwrapped + @Getter(AccessLevel.NONE) + private ListForHearingWrapper listForHearingWrapper; private List judgeAllocated; private YesOrNo applicationAllocatedTo; private YesOrNo caseAllocatedTo; @@ -1018,4 +1013,11 @@ public DraftOrdersWrapper getDraftOrdersWrapper() { return draftOrdersWrapper; } + @JsonIgnore + public ListForHearingWrapper getListForHearingWrapper() { + if (listForHearingWrapper == null) { + listForHearingWrapper = new ListForHearingWrapper(); + } + return listForHearingWrapper; + } } diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/wrapper/ListForHearingWrapper.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/wrapper/ListForHearingWrapper.java new file mode 100644 index 0000000000..26b57df1c4 --- /dev/null +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/wrapper/ListForHearingWrapper.java @@ -0,0 +1,34 @@ +package uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.AdditionalHearingDocumentCollection; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.HasCaseDocument; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.HearingTypeDirection; + +import java.time.LocalDate; +import java.util.List; + +@JsonIgnoreProperties(ignoreUnknown = true) +@Data +@Builder(toBuilder = true) +@AllArgsConstructor +@NoArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ListForHearingWrapper implements HasCaseDocument { + private HearingTypeDirection hearingType; + private String timeEstimate; + @JsonSerialize(using = LocalDateSerializer.class) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + private LocalDate hearingDate; + private String hearingTime; + private String additionalInformationAboutHearing; + private List additionalHearingDocuments; +} diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/AdditionalHearingDocumentService.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/AdditionalHearingDocumentService.java index 997250c9cb..032a61d49a 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/AdditionalHearingDocumentService.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/AdditionalHearingDocumentService.java @@ -297,12 +297,13 @@ protected void addAdditionalHearingDocumentToCaseData(FinremCaseDetails caseDeta .build(); FinremCaseData data = caseDetails.getData(); - List additionalHearingDocumentCollections - = Optional.ofNullable(data.getAdditionalHearingDocuments()).orElse(new ArrayList<>(1)); + List additionalHearingDocumentCollections = Optional.ofNullable( + data.getListForHearingWrapper().getAdditionalHearingDocuments()) + .orElse(new ArrayList<>(1)); additionalHearingDocumentCollections.add(generatedDocumentData); - data.setAdditionalHearingDocuments(additionalHearingDocumentCollections); + data.getListForHearingWrapper().setAdditionalHearingDocuments(additionalHearingDocumentCollections); } diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ApprovedOrderNoticeOfHearingService.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ApprovedOrderNoticeOfHearingService.java index 11388aea81..dadd5b08f3 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ApprovedOrderNoticeOfHearingService.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ApprovedOrderNoticeOfHearingService.java @@ -96,9 +96,9 @@ private DocumentCollection getDocumentCollectionObj(CaseDocument caseDocument) { } private void addAdditionalHearingDocument(FinremCaseData caseData, CaseDocument documentToAdd) { - - List additionalHearingDocuments - = Optional.ofNullable(caseData.getAdditionalHearingDocuments()).orElse(new ArrayList<>()); + List additionalHearingDocuments = Optional + .ofNullable(caseData.getListForHearingWrapper().getAdditionalHearingDocuments()) + .orElse(new ArrayList<>()); AdditionalHearingDocumentCollection hearingDocumentCollection = AdditionalHearingDocumentCollection.builder() @@ -108,7 +108,7 @@ private void addAdditionalHearingDocument(FinremCaseData caseData, CaseDocument .build()).build(); additionalHearingDocuments.add(hearingDocumentCollection); - caseData.setAdditionalHearingDocuments(additionalHearingDocuments); + caseData.getListForHearingWrapper().setAdditionalHearingDocuments(additionalHearingDocuments); } public void printHearingNoticePackAndSendToApplicantAndRespondent(CaseDetails caseDetails, diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/HearingService.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/HearingService.java index 13fc600961..1afb12c9bf 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/HearingService.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/HearingService.java @@ -11,6 +11,7 @@ import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.HearingTypeDirection; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.InterimHearingCollection; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.InterimTypeOfHearing; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.ListForHearingWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.utils.FinremDateUtils; import java.time.LocalDate; @@ -82,9 +83,9 @@ public DynamicList generateSelectableHearingsAsDynamicList(FinremCaseDetails cas Map elementToSortingKeyMap = new HashMap<>(); FinremCaseData caseData = caseDetails.getData(); - HearingTypeDirection hearingType = caseData.getHearingType(); - LocalDate hearingDate = caseData.getHearingDate(); - String hearingTime = caseData.getHearingTime(); + HearingTypeDirection hearingType = caseData.getListForHearingWrapper().getHearingType(); + LocalDate hearingDate = caseData.getListForHearingWrapper().getHearingDate(); + String hearingTime = caseData.getListForHearingWrapper().getHearingTime(); DynamicListElement topLevelDynamicListElement = buildTopLevelHearingDynamicListElement(hearingType, hearingDate, hearingTime); if (topLevelDynamicListElement != null) { @@ -119,7 +120,7 @@ DynamicList generateSelectableHearingsAsDynamicList(List dyn } public LocalDate getHearingDate(FinremCaseData caseData, DynamicListElement selected) { - return getHearingInfo(caseData, selected, FinremCaseData::getHearingDate, ihc -> ihc.getValue().getInterimHearingDate()); + return getHearingInfo(caseData, selected, ListForHearingWrapper::getHearingDate, ihc -> ihc.getValue().getInterimHearingDate()); } public String getHearingType(FinremCaseData caseData, DynamicListElement selected) { @@ -128,12 +129,12 @@ public String getHearingType(FinremCaseData caseData, DynamicListElement selecte } public String getHearingTime(FinremCaseData caseData, DynamicListElement selected) { - return getHearingInfo(caseData, selected, FinremCaseData::getHearingTime, ihc -> ihc.getValue().getInterimHearingTime()); + return getHearingInfo(caseData, selected, ListForHearingWrapper::getHearingTime, ihc -> ihc.getValue().getInterimHearingTime()); } // Helper method to get hearing information private T getHearingInfo(FinremCaseData caseData, DynamicListElement selected, - Function hearingExtractor, + Function hearingExtractor, Function extractor) { if (StringUtils.isEmpty(selected.getCode())) { return null; @@ -141,7 +142,7 @@ private T getHearingInfo(FinremCaseData caseData, DynamicListElement selecte // Return time estimate for top-level hearing if (TOP_LEVEL_HEARING_ID.equals(selected.getCode())) { - return hearingExtractor.apply(caseData); // Use hearingExtractor to get the value + return hearingExtractor.apply(caseData.getListForHearingWrapper()); // Use hearingExtractor to get the value } // Search for the matching InterimHearingCollection diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ValidateHearingService.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ValidateHearingService.java index 4b9514061a..5e4ec49ce9 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ValidateHearingService.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ValidateHearingService.java @@ -35,7 +35,7 @@ public List validateHearingErrors(FinremCaseDetails finremCaseDetails) { List errors = new ArrayList<>(); if (caseData.getIssueDate() == null - || caseData.getHearingDate() == null + || caseData.getListForHearingWrapper().getHearingDate() == null || caseData.getFastTrackDecision() == null) { errors.add(REQUIRED_FIELD_EMPTY_ERROR); } @@ -50,7 +50,7 @@ public List validateHearingErrors(FinremCaseDetails finremCaseDetails) { public List validateHearingWarnings(FinremCaseDetails caseDetails) { FinremCaseData caseData = caseDetails.getData(); LocalDate issueDate = caseData.getIssueDate(); - LocalDate hearingDate = caseData.getHearingDate(); + LocalDate hearingDate = caseData.getListForHearingWrapper().getHearingDate(); boolean fastTrackApplication = caseData.isFastTrackApplication(); if (fastTrackApplication) { diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremAdditionalHearingCorresponder.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremAdditionalHearingCorresponder.java index cbf4cda451..13be8ec870 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremAdditionalHearingCorresponder.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremAdditionalHearingCorresponder.java @@ -31,7 +31,8 @@ public FinremAdditionalHearingCorresponder(BulkPrintService bulkPrintService, @Override public List getCaseDocuments(FinremCaseDetails caseDetails) { List documents = new ArrayList<>(); - List additionalHearingDocuments = caseDetails.getData().getAdditionalHearingDocuments(); + List additionalHearingDocuments = caseDetails.getData() + .getListForHearingWrapper().getAdditionalHearingDocuments(); if (additionalHearingDocuments != null && !additionalHearingDocuments.isEmpty()) { additionalHearingDocuments.sort(Comparator.comparing(o -> diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/ccd/datamigration/controller/helper/DocumentHelperTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/ccd/datamigration/controller/helper/DocumentHelperTest.java index 6ceea78322..aeb92b844d 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/ccd/datamigration/controller/helper/DocumentHelperTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/ccd/datamigration/controller/helper/DocumentHelperTest.java @@ -284,7 +284,7 @@ public void getLatestAdditionalHearingDocument() { additionalHearingDocuments.add(doc1); additionalHearingDocuments.add(doc2); - caseData.setAdditionalHearingDocuments(additionalHearingDocuments); + caseData.getListForHearingWrapper().setAdditionalHearingDocuments(additionalHearingDocuments); Optional latestDocumentAvailable = documentHelper.getLatestAdditionalHearingDocument(caseData); diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToSubmitHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToSubmitHandlerTest.java index e665440a80..98aea19c0a 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToSubmitHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToSubmitHandlerTest.java @@ -100,7 +100,7 @@ void givenContestedCase_whenNotFastTrackDecision_thenShouldThrowWarnings() { when(finremCaseDetailsMapper.mapToFinremCaseDetails(any(CaseDetails.class))).thenReturn(finremCallbackRequest.getCaseDetails()); when(finremCaseDetailsMapper.mapToCaseDetails(any(FinremCaseDetails.class))).thenReturn(callbackRequest.getCaseDetails()); finremCallbackRequest.getCaseDetails().getData().setIssueDate(LocalDate.now().minusDays(1)); - finremCallbackRequest.getCaseDetails().getData().setHearingDate(LocalDate.now().plusDays(1)); + finremCallbackRequest.getCaseDetails().getData().getListForHearingWrapper().setHearingDate(LocalDate.now().plusDays(1)); GenericAboutToStartOrSubmitCallbackResponse response = aboutToSubmitHandler.handle(finremCallbackRequest, AUTH_TOKEN); assertThat(response.getWarnings().get(0), equalTo(FAST_TRACK_WARNING)); } diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/hearingbundles/HearingDatePopulatedValidatorTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/hearingbundles/HearingDatePopulatedValidatorTest.java index 9d2455c02c..353c1164a8 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/hearingbundles/HearingDatePopulatedValidatorTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/hearingbundles/HearingDatePopulatedValidatorTest.java @@ -2,6 +2,7 @@ import org.junit.Test; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.FinremCaseData; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.ListForHearingWrapper; import java.time.LocalDate; @@ -18,7 +19,8 @@ public void shouldReturn_error_whenHearingDateNotPopulated() { @Test public void shouldReturn_no_error_whenHearingDatePopulated() { - assertTrue(hearingDatePopulatedValidator.validateHearingDate(FinremCaseData.builder().hearingDate(LocalDate.now()).build()).isEmpty()); + assertTrue(hearingDatePopulatedValidator.validateHearingDate(FinremCaseData.builder() + .listForHearingWrapper(ListForHearingWrapper.builder().hearingDate(LocalDate.now()).build()) + .build()).isEmpty()); } - } diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/integrationtest/HearingNonFastTrackDocumentTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/integrationtest/HearingNonFastTrackDocumentTest.java index 8a49ece02b..ff25c3756b 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/integrationtest/HearingNonFastTrackDocumentTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/integrationtest/HearingNonFastTrackDocumentTest.java @@ -137,11 +137,12 @@ public static void loadJsonString() throws IOException { @Before public void setUp() throws IOException { + LocalDate hearingDate = LocalDate.now().plusDays(100); request = objectMapper.readValue(requestJson, CallbackRequest.class); - request.getCaseDetails().getData().put("hearingDate", LocalDate.now().plusDays(100)); + request.getCaseDetails().getData().put("hearingDate", hearingDate); request.getCaseDetails().getData().put("issueDate", LocalDate.now()); finremRequest = objectMapper.readValue(requestJson, FinremCallbackRequest.class); - finremRequest.getCaseDetails().getData().setHearingDate(LocalDate.now().plusDays(100)); + finremRequest.getCaseDetails().getData().getListForHearingWrapper().setHearingDate(hearingDate); finremRequest.getCaseDetails().getData().setIssueDate(LocalDate.now()); } @@ -166,7 +167,7 @@ private void doMissingMustFieldTest(String missingFieldKey) throws Exception { finremCaseDetails.getData().setFastTrackDecision(null); } if (missingFieldKey.equals(HEARING_DATE)) { - finremCaseDetails.getData().setHearingDate(null); + finremCaseDetails.getData().getListForHearingWrapper().setHearingDate(null); } if (missingFieldKey.equals(ISSUE_DATE)) { finremCaseDetails.getData().setIssueDate(null); diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/FinremCaseDetailMapperTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/FinremCaseDetailMapperTest.java index 6c4337e487..72e30efb65 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/FinremCaseDetailMapperTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/FinremCaseDetailMapperTest.java @@ -370,7 +370,7 @@ private void assertEnums(FinremCaseData caseData) { assertEquals(ApplicantRole.FR_ApplicantsRoleInDivorce_1, caseData.getDivRoleOfFrApplicant()); assertEquals(ApplicantRepresentedPaper.FR_applicant_represented_1, caseData.getApplicantRepresentedPaper()); assertEquals(AuthorisationSignedBy.LITIGATION_FRIEND, caseData.getAuthorisationSignedBy()); - assertEquals(HearingTypeDirection.DIR, caseData.getHearingType()); + assertEquals(HearingTypeDirection.DIR, caseData.getListForHearingWrapper().getHearingType()); assertTrue(caseData.getJudgeAllocated().containsAll(List.of( JudgeAllocated.FR_JUDGE_ALLOCATED_LIST_1, JudgeAllocated.FR_JUDGE_ALLOCATED_LIST_3))); @@ -516,7 +516,7 @@ private void assertAdditionalHearingDocuments(FinremCaseData caseData) { .build() ); - assertEquals(1, caseData.getAdditionalHearingDocuments().size()); + assertEquals(1, caseData.getListForHearingWrapper().getAdditionalHearingDocuments().size()); } private void assertUploadGeneralDocuments(FinremCaseData caseData) { diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/FinremNotificationRequestMapperTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/FinremNotificationRequestMapperTest.java index dab143e913..04c96a21f2 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/FinremNotificationRequestMapperTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/FinremNotificationRequestMapperTest.java @@ -164,7 +164,7 @@ void shouldReturnEmptyStringForSolicitorReferenceWhenNotProvided() { @Test void shouldReturnHearingTypeForPrepareForHearingContestedEventInvoke() { FinremCaseDetails caseDetails = getContestedFinremCaseDetails(); - caseDetails.getData().setHearingType(HearingTypeDirection.FDA); + caseDetails.getData().getListForHearingWrapper().setHearingType(HearingTypeDirection.FDA); NotificationRequest notificationRequest = notificationRequestMapper.getNotificationRequestForApplicantSolicitor( caseDetails); @@ -182,7 +182,7 @@ void shouldReturnHearingTypeForPrepareForHearingContestedEventInvoke() { @Test void shouldReturnHearingTypeForPrepareForHearingContestedEventInvokeIntervener() { FinremCaseDetails caseDetails = getContestedFinremCaseDetails(); - caseDetails.getData().setHearingType(HearingTypeDirection.FDA); + caseDetails.getData().getListForHearingWrapper().setHearingType(HearingTypeDirection.FDA); SolicitorCaseDataKeysWrapper dataKeysWrapper = SolicitorCaseDataKeysWrapper.builder() .solicitorEmailKey(TEST_SOLICITOR_EMAIL) .solicitorNameKey(TEST_SOLICITOR_NAME) diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formc/FormCLetterDetailsMapperTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formc/FormCLetterDetailsMapperTest.java index a15635fc26..3a17a583d0 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formc/FormCLetterDetailsMapperTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formc/FormCLetterDetailsMapperTest.java @@ -96,12 +96,12 @@ private void setCaseDetails() { caseData.getContactDetailsWrapper().setRespondentLname("Respondent"); caseData.setDivorceCaseNumber("DD12D12345"); caseData.getRegionWrapper().getDefaultCourtList().setBristolCourtList(BristolCourt.BRISTOL_CIVIL_AND_FAMILY_JUSTICE_CENTRE); - caseData.setHearingDate(HEARING_DATE); + caseData.getListForHearingWrapper().setHearingDate(HEARING_DATE); caseData.getContactDetailsWrapper().setSolicitorReference("Test Sol Reference"); caseData.getContactDetailsWrapper().setRespondentSolicitorReference("Test Resp Sol Ref"); - caseData.setAdditionalInformationAboutHearing("Test"); - caseData.setHearingTime("1pm"); - caseData.setTimeEstimate("1 hour"); + caseData.getListForHearingWrapper().setAdditionalInformationAboutHearing("Test"); + caseData.getListForHearingWrapper().setHearingTime("1pm"); + caseData.getListForHearingWrapper().setTimeEstimate("1 hour"); caseDetails = FinremCaseDetails.builder().id(12345L).caseType(CaseType.CONTESTED).data(caseData).build(); } diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formg/FormGLetterDetailsMapperTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formg/FormGLetterDetailsMapperTest.java index 6b33dc6e9b..9c0523ba74 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formg/FormGLetterDetailsMapperTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/letterdetails/formg/FormGLetterDetailsMapperTest.java @@ -30,7 +30,7 @@ public class FormGLetterDetailsMapperTest extends AbstractLetterDetailsMapperTes private FormGLetterDetailsMapper formGLetterDetailsMapper; @Before - public void setUp() throws Exception { + public void setUp() { setCaseDetails(); } @@ -83,10 +83,10 @@ private void setCaseDetails() { caseData.getContactDetailsWrapper().setRespondentLname("Respondent"); caseData.setDivorceCaseNumber("DD12D12345"); caseData.getRegionWrapper().getDefaultCourtList().setBristolCourtList(BristolCourt.BRISTOL_CIVIL_AND_FAMILY_JUSTICE_CENTRE); - caseData.setHearingDate(HEARING_DATE); + caseData.getListForHearingWrapper().setHearingDate(HEARING_DATE); caseData.getContactDetailsWrapper().setSolicitorReference("Test Sol Reference"); caseData.getContactDetailsWrapper().setRespondentSolicitorReference("Test Resp Sol Ref"); - caseData.setHearingTime("1pm"); + caseData.getListForHearingWrapper().setHearingTime("1pm"); caseDetails = FinremCaseDetails.builder().id(12343L).caseType(CaseType.CONTESTED).data(caseData).build(); } diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/AdditionalHearingDocumentServiceTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/AdditionalHearingDocumentServiceTest.java index 5dbb5aeced..155a131e1a 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/AdditionalHearingDocumentServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/AdditionalHearingDocumentServiceTest.java @@ -199,7 +199,8 @@ public void givenCreateAndStoreAdditionalHearingDocumentsWhenFinalOrderCollIsEmp assertEquals(1, data.getFinalOrderCollection().size()); assertEquals(1, data.getUploadHearingOrder().size()); assertEquals(FILE_NAME, data.getLatestDraftHearingOrder().getDocumentFilename()); - assertEquals(caseDocument(), data.getAdditionalHearingDocuments().get(0).getValue().getDocument()); + assertEquals(caseDocument(), data.getListForHearingWrapper() + .getAdditionalHearingDocuments().get(0).getValue().getDocument()); } @Test @@ -254,7 +255,8 @@ public void givenCreateAndStoreAdditionalHearingDocumentsWhenFinalOrderHasSameOr assertEquals(1, data.getFinalOrderCollection().size()); assertEquals(1, data.getUploadHearingOrder().size()); assertEquals(FILE_NAME, data.getLatestDraftHearingOrder().getDocumentFilename()); - assertEquals(caseDocument(), data.getAdditionalHearingDocuments().get(0).getValue().getDocument()); + assertEquals(caseDocument(), data.getListForHearingWrapper() + .getAdditionalHearingDocuments().get(0).getValue().getDocument()); } @Test @@ -311,7 +313,8 @@ public void givenCreateAndStoreAdditionalHearingDocumentsWhenFinalOrderIsNotSame assertEquals(2, data.getFinalOrderCollection().size()); assertEquals(1, data.getUploadHearingOrder().size()); assertEquals(FILE_NAME, data.getLatestDraftHearingOrder().getDocumentFilename()); - assertEquals(caseDocument(), data.getAdditionalHearingDocuments().get(0).getValue().getDocument()); + assertEquals(caseDocument(), data.getListForHearingWrapper() + .getAdditionalHearingDocuments().get(0).getValue().getDocument()); } @Test @@ -363,7 +366,7 @@ public void givenCreateAndStoreAdditionalHearingDocumentsWhenFinalOrderIsNotSame assertEquals(2, data.getFinalOrderCollection().size()); assertEquals(1, data.getUploadHearingOrder().size()); assertEquals(FILE_NAME, data.getLatestDraftHearingOrder().getDocumentFilename()); - assertNull(data.getAdditionalHearingDocuments()); + assertNull(data.getListForHearingWrapper().getAdditionalHearingDocuments()); } @Test diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ApprovedOrderNoticeOfHearingServiceTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ApprovedOrderNoticeOfHearingServiceTest.java index 7a6be78527..16631cb6a2 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ApprovedOrderNoticeOfHearingServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ApprovedOrderNoticeOfHearingServiceTest.java @@ -137,7 +137,8 @@ public void givenHearingRequired_whenSubmitNoticeOfHearing_thenHearingNoticeIsPr approvedOrderNoticeOfHearingService.createAndStoreHearingNoticeDocumentPack(caseDetails, AUTH_TOKEN); - List additionalHearingDocuments = data.getAdditionalHearingDocuments(); + List additionalHearingDocuments = data.getListForHearingWrapper() + .getAdditionalHearingDocuments(); assertEquals("Not null", caseDocument(), additionalHearingDocuments.get(0).getValue().getDocument()); assertEquals("size of Notice Pack",1, data.getHearingNoticeDocumentPack().size()); verify(genericDocumentService).generateDocumentFromPlaceholdersMap( @@ -198,7 +199,8 @@ public void givenHearingRequired_whenSubmitNoticeOfHearingWithDraftHearing_thenH approvedOrderNoticeOfHearingService.createAndStoreHearingNoticeDocumentPack(caseDetails, AUTH_TOKEN); - List additionalHearingDocuments = data.getAdditionalHearingDocuments(); + List additionalHearingDocuments = data.getListForHearingWrapper() + .getAdditionalHearingDocuments(); assertEquals("Not null", caseDocument(), additionalHearingDocuments.get(0).getValue().getDocument()); assertEquals("size of Notice Pack",2, data.getHearingNoticeDocumentPack().size()); verify(genericDocumentService).generateDocumentFromPlaceholdersMap( diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/HearingServiceTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/HearingServiceTest.java index 3fc87dbf97..4c2512b1c2 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/HearingServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/HearingServiceTest.java @@ -15,6 +15,7 @@ import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.InterimHearingItem; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.InterimTypeOfHearing; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.InterimWrapper; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.ListForHearingWrapper; import java.time.LocalDate; import java.util.Arrays; @@ -285,16 +286,11 @@ void generateSelectableHearingsAsDynamicList(HearingTypeDirection topLevelHearin FinremCaseData.FinremCaseDataBuilder caseDataBuilder = FinremCaseData.builder() .interimWrapper(InterimWrapper.builder().interimHearings(interimHearings).build()); - // Set top-level fields only if they are not null - if (topLevelHearingType != null) { - caseDataBuilder.hearingType(topLevelHearingType); - } - if (topLevelHearingDate != null) { - caseDataBuilder.hearingDate(topLevelHearingDate); - } - if (topLevelHearingTime != null) { - caseDataBuilder.hearingTime(topLevelHearingTime); - } + caseDataBuilder.listForHearingWrapper(ListForHearingWrapper.builder() + .hearingType(topLevelHearingType) + .hearingDate(topLevelHearingDate) + .hearingTime(topLevelHearingTime) + .build()); FinremCaseDetails caseDetails = mock(FinremCaseDetails.class); FinremCaseData caseData = caseDataBuilder.build(); @@ -350,16 +346,6 @@ static Stream hearingTimeCases() { ); } - static Stream hearingTimeEstimateCases() { - return Stream.of( - Arguments.of("", null), // Edge case: empty selected code - Arguments.of(TOP_LEVEL_HEARING_ID, "1 hour"), // Top-level hearing time - Arguments.of("11000000-0000-0000-0000-000000000000", "1.5 hour"), // Valid interim hearing time - Arguments.of("22000000-0000-0000-0000-000000000000", null), // Non-matching ID - Arguments.of(null, null) // Case with null value in Interim Hearing - ); - } - @ParameterizedTest @MethodSource("hearingDateCases") void testGetHearingDate(String selectedCode, LocalDate expectedDate) { @@ -369,7 +355,7 @@ void testGetHearingDate(String selectedCode, LocalDate expectedDate) { when(selected.getCode()).thenReturn(selectedCode); // Mocking the data structure - caseData.setHearingDate(LocalDate.of(2024, 10, 21)); + caseData.getListForHearingWrapper().setHearingDate(LocalDate.of(2024, 10, 21)); // Mocking the data structure based on the singleInterimHearing parameter if (singleInterimHearing) { caseData.setInterimWrapper(InterimWrapper.builder() @@ -413,7 +399,7 @@ void testGetHearingType(String selectedCode, String expectedType) { when(selected.getCode()).thenReturn(selectedCode); // Mocking the data structure - caseData.setHearingType(HearingTypeDirection.FH); + caseData.getListForHearingWrapper().setHearingType(HearingTypeDirection.FH); // Mocking the data structure if (singleInterimHearing) { caseData.setInterimWrapper(InterimWrapper.builder() @@ -457,7 +443,7 @@ void testGetHearingTime(String selectedCode, String expectedTime) { when(selected.getCode()).thenReturn(selectedCode); // Mocking the data structure - caseData.setHearingTime("09:00 AM"); + caseData.getListForHearingWrapper().setHearingTime("09:00 AM"); // Mocking the data structure if (singleInterimHearing) { caseData.setInterimWrapper(InterimWrapper.builder() diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ValidateHearingServiceTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ValidateHearingServiceTest.java index 85514fbe8c..9398878cf4 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ValidateHearingServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/ValidateHearingServiceTest.java @@ -44,7 +44,7 @@ public void setup() { public void issueDateEmpty() { caseData.setFastTrackDecision(YesOrNo.YES); caseData.setIssueDate(null); - caseData.setHearingDate(LocalDate.now().plusWeeks(7)); + caseData.getListForHearingWrapper().setHearingDate(LocalDate.now().plusWeeks(7)); List errors = doTestErrors(); caseData.setPartiesOnCase(getPartiesOnCase()); @@ -54,7 +54,7 @@ public void issueDateEmpty() { @Test public void fastTrackDecisionEmpty() { caseData.setIssueDate(LocalDate.now()); - caseData.setHearingDate(LocalDate.now().plusWeeks(7)); + caseData.getListForHearingWrapper().setHearingDate(LocalDate.now().plusWeeks(7)); caseData.setFastTrackDecisionReason(null); caseData.setPartiesOnCase(getPartiesOnCase()); @@ -66,7 +66,7 @@ public void fastTrackDecisionEmpty() { public void hearingDateEmpty() { caseData.setIssueDate(LocalDate.now()); caseData.setFastTrackDecision(YesOrNo.YES); - caseData.setHearingDate(null); + caseData.getListForHearingWrapper().setHearingDate(null); caseData.setPartiesOnCase(getPartiesOnCase()); List errors = doTestErrors(); assertThat(errors, hasItem(ISSUE_DATE_FAST_TRACK_DECISION_OR_HEARING_DATE_IS_EMPTY)); @@ -76,7 +76,7 @@ public void hearingDateEmpty() { public void givenHearingWithNoAppRespNotificationSelected_whenValidate_thenThrowErrorCustomMessage() { caseData.setIssueDate(LocalDate.now()); caseData.setFastTrackDecision(YesOrNo.YES); - caseData.setHearingDate(LocalDate.now().plusWeeks(7)); + caseData.getListForHearingWrapper().setHearingDate(LocalDate.now().plusWeeks(7)); DynamicMultiSelectList partiesOnCase = getPartiesOnCaseMissingSelectedAppAndResp(); @@ -127,7 +127,7 @@ private DynamicMultiSelectListElement getDynamicElementList(String role) { public void noErrors() { caseData.setIssueDate(LocalDate.now()); caseData.setFastTrackDecision(YesOrNo.YES); - caseData.setHearingDate(LocalDate.now().plusWeeks(7)); + caseData.getListForHearingWrapper().setHearingDate(LocalDate.now().plusWeeks(7)); List errors = doTestErrors(); assertThat(errors, hasSize(0)); } @@ -136,7 +136,7 @@ public void noErrors() { public void fastTrackHearingDatesWarningWithJudiciaryOutcome() { caseData.setIssueDate(LocalDate.now()); caseData.setFastTrackDecision(null); - caseData.setHearingDate(LocalDate.now().plusWeeks(3)); + caseData.getListForHearingWrapper().setHearingDate(LocalDate.now().plusWeeks(3)); caseData.setCaseAllocatedTo(YesOrNo.YES); List errors = doTestWarnings(); assertThat(errors, hasItem(DATE_BETWEEN_6_AND_10_WEEKS)); @@ -146,7 +146,7 @@ public void fastTrackHearingDatesWarningWithJudiciaryOutcome() { public void fastTrackHearingDatesWarningWithoutJudiciaryOutcome() { caseData.setIssueDate(LocalDate.now()); caseData.setFastTrackDecision(YesOrNo.YES); - caseData.setHearingDate(LocalDate.now().plusWeeks(3)); + caseData.getListForHearingWrapper().setHearingDate(LocalDate.now().plusWeeks(3)); List errors = doTestWarnings(); assertThat(errors, hasItem(DATE_BETWEEN_6_AND_10_WEEKS)); } @@ -155,7 +155,7 @@ public void fastTrackHearingDatesWarningWithoutJudiciaryOutcome() { public void fastTrackHearingDatesNoWarning() { caseData.setIssueDate(LocalDate.now()); caseData.setFastTrackDecision(YesOrNo.YES); - caseData.setHearingDate(LocalDate.now().plusWeeks(7)); + caseData.getListForHearingWrapper().setHearingDate(LocalDate.now().plusWeeks(7)); List errors = doTestWarnings(); assertThat(errors, hasSize(0)); } @@ -164,7 +164,7 @@ public void fastTrackHearingDatesNoWarning() { public void nonFastTrackHearingDatesWarning() { caseData.setIssueDate(LocalDate.now()); caseData.setFastTrackDecision(YesOrNo.NO); - caseData.setHearingDate(LocalDate.now().plusWeeks(3)); + caseData.getListForHearingWrapper().setHearingDate(LocalDate.now().plusWeeks(3)); List errors = doTestWarnings(); assertThat(errors, hasItem(DATE_BETWEEN_12_AND_16_WEEKS)); } @@ -173,7 +173,7 @@ public void nonFastTrackHearingDatesWarning() { public void nonFastTrackHearingDatesNoWarning() { caseData.setIssueDate(LocalDate.now()); caseData.setFastTrackDecision(YesOrNo.NO); - caseData.setHearingDate(LocalDate.now().plusWeeks(13)); + caseData.getListForHearingWrapper().setHearingDate(LocalDate.now().plusWeeks(13)); List errors = doTestWarnings(); assertThat(errors, hasSize(0)); } diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremAdditionalHearingCorresponderTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremAdditionalHearingCorresponderTest.java index b73f3b204e..74eae6b335 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremAdditionalHearingCorresponderTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremAdditionalHearingCorresponderTest.java @@ -65,7 +65,7 @@ void shouldGetDocumentsToPrintIfGetAdditionalHearingDocumentDateIsNull(boolean t additionalHearingDocumentCollections.add(document2); additionalHearingDocumentCollections.add(document3); additionalHearingDocumentCollections.add(document4); - caseDetails.getData().setAdditionalHearingDocuments(additionalHearingDocumentCollections); + caseDetails.getData().getListForHearingWrapper().setAdditionalHearingDocuments(additionalHearingDocumentCollections); List documentsToPrint = applicantAndRespondentMultiLetterCorresponder.getCaseDocuments(caseDetails); assertEquals(2, documentsToPrint.size()); assertThat(documentsToPrint).contains(CaseDocument.builder().documentFilename("latest").build()); @@ -98,7 +98,7 @@ void shouldGetDocumentsToPrintIfGetAdditionalHearingDocumentDateIsNotNull() { additionalHearingDocumentCollections.add(document2); additionalHearingDocumentCollections.add(document3); additionalHearingDocumentCollections.add(document4); - caseDetails.getData().setAdditionalHearingDocuments(additionalHearingDocumentCollections); + caseDetails.getData().getListForHearingWrapper().setAdditionalHearingDocuments(additionalHearingDocumentCollections); List documentsToPrint = applicantAndRespondentMultiLetterCorresponder.getCaseDocuments(caseDetails); assertEquals(2, documentsToPrint.size()); assertThat(documentsToPrint).contains(CaseDocument.builder().documentFilename("latest").build()); diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremFormCandGCorresponderTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremFormCandGCorresponderTest.java index 83350bd6f1..e2d1124e4f 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremFormCandGCorresponderTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremFormCandGCorresponderTest.java @@ -16,6 +16,7 @@ import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.PaymentDocumentCollection; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.PaymentDocumentType; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.YesOrNo; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.ListForHearingWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.service.CaseDataService; import uk.gov.hmcts.reform.finrem.caseorchestration.service.GenericDocumentService; import uk.gov.hmcts.reform.finrem.caseorchestration.service.InternationalPostalService; @@ -43,7 +44,7 @@ class FinremFormCandGCorresponderTest extends FinremHearingCorrespondenceBaseTes private static final String DATE_OF_HEARING = "2019-01-01"; @BeforeEach - public void setUp() throws Exception { + public void setUp() { caseDetails = caseDetails(); applicantAndRespondentMultiLetterCorresponder = new FinremFormCandGCorresponder(bulkPrintService, notificationService, @@ -59,7 +60,9 @@ void getDocumentsToPrint() { private FinremCaseDetails caseDetails() { FinremCaseData caseData = FinremCaseData.builder() - .hearingDate(LocalDate.parse(DATE_OF_HEARING)) + .listForHearingWrapper(ListForHearingWrapper.builder() + .hearingDate(LocalDate.parse(DATE_OF_HEARING)) + .build()) .fastTrackDecision(YesOrNo.forValue(NO_VALUE)) .formC(caseDocument()) .formG(caseDocument()) diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/documentcatergory/HearingNoticesCategoriserTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/documentcatergory/HearingNoticesCategoriserTest.java index e77b56f910..b431de9c16 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/documentcatergory/HearingNoticesCategoriserTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/documentcatergory/HearingNoticesCategoriserTest.java @@ -7,6 +7,7 @@ import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.CaseDocument; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.DocumentCollection; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.FinremCaseData; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.ListForHearingWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.model.document.DocumentCategory; import uk.gov.hmcts.reform.finrem.caseorchestration.service.FeatureToggleService; @@ -71,7 +72,9 @@ private FinremCaseData getFinremCaseData() { return FinremCaseData.builder() .hearingNoticeDocumentPack(hearingNoticeDocumentPack) - .additionalHearingDocuments(additionalHearingDocuments) + .listForHearingWrapper(ListForHearingWrapper.builder() + .additionalHearingDocuments(additionalHearingDocuments) + .build()) .build(); } diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/documentchecker/DuplicateFilenameDocumentCheckerTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/documentchecker/DuplicateFilenameDocumentCheckerTest.java index 8fc0c91fc0..f1fcdba1c0 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/documentchecker/DuplicateFilenameDocumentCheckerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/documentchecker/DuplicateFilenameDocumentCheckerTest.java @@ -95,6 +95,7 @@ import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.GeneralLetterWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.GeneralOrderWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.InterimWrapper; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.ListForHearingWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.OrderWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.UploadCaseDocumentWrapper; @@ -328,12 +329,14 @@ static Stream testGetWarningsOnExistingCase() { .build())) .build()), Arguments.of(FinremCaseData.builder() - .additionalHearingDocuments(List.of(AdditionalHearingDocumentCollection.builder() - .value(AdditionalHearingDocument.builder() - .document(DUPLICATED_CASE_DOCUMENT) + .listForHearingWrapper(ListForHearingWrapper.builder() + .additionalHearingDocuments(List.of(AdditionalHearingDocumentCollection.builder() + .value(AdditionalHearingDocument.builder() + .document(DUPLICATED_CASE_DOCUMENT) + .build()) + .build())) .build()) - .build())) - .build()), + .build()), Arguments.of(FinremCaseData.builder() .hearingNoticeDocumentPack(List.of(DocumentCollection.builder() .value(DUPLICATED_CASE_DOCUMENT) From 0597f6417d71953174306f494707069d5344ca92 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Thu, 14 Nov 2024 16:27:36 +0000 Subject: [PATCH 2/2] Move List for Hearing fields into wrapper class --- .../handler/ContestedListForHearingMidHandler.java | 5 +++-- .../ListForHearingContestedAboutToStartHandler.java | 4 ++-- .../ListForHearingContestedAboutToSubmitHandler.java | 8 +++++--- .../caseorchestration/model/ccd/FinremCaseData.java | 3 --- .../model/ccd/wrapper/ListForHearingWrapper.java | 11 +++++++++++ .../model/ccd/wrapper/RegionWrapper.java | 4 ---- .../hearing/FinremAdditionalHearingCorresponder.java | 3 ++- .../hearing/FinremFormCandGCorresponder.java | 5 +---- .../ContestedListForHearingMidHandlerTest.java | 8 ++++---- ...istForHearingContestedAboutToStartHandlerTest.java | 2 +- .../hearing/FinremFormCandGCorresponderTest.java | 2 +- .../DuplicateFilenameDocumentCheckerTest.java | 4 +++- 12 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ContestedListForHearingMidHandler.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ContestedListForHearingMidHandler.java index 710d134915..a94d7f4de9 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ContestedListForHearingMidHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ContestedListForHearingMidHandler.java @@ -43,8 +43,9 @@ public GenericAboutToStartOrSubmitCallbackResponse handle(Finrem EventType.LIST_FOR_HEARING, caseId); FinremCaseData caseData = caseDetails.getData(); List errors = new ArrayList<>(); - if (caseData.getAdditionalHearingDocumentsOption().isYes()) { - CaseDocument additionalListOfHearingDocument = caseData.getAdditionalListOfHearingDocuments(); + if (caseData.getListForHearingWrapper().getAdditionalHearingDocumentsOption().isYes()) { + CaseDocument additionalListOfHearingDocument = caseData.getListForHearingWrapper() + .getAdditionalListOfHearingDocuments(); service.validateEncryptionOnUploadedDocument(additionalListOfHearingDocument, caseId, errors, userAuthorisation); } diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToStartHandler.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToStartHandler.java index a05ec13f95..3952efdc39 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToStartHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToStartHandler.java @@ -39,8 +39,8 @@ public GenericAboutToStartOrSubmitCallbackResponse handle(Finrem FinremCaseDetails caseDetails = callbackRequest.getCaseDetails(); FinremCaseData caseData = callbackRequest.getCaseDetails().getData(); - if (caseData.getAdditionalHearingDocumentsOption() == null) { - caseData.setAdditionalHearingDocumentsOption(YesOrNo.NO); + if (caseData.getListForHearingWrapper().getAdditionalHearingDocumentsOption() == null) { + caseData.getListForHearingWrapper().setAdditionalHearingDocumentsOption(YesOrNo.NO); } caseData.setPartiesOnCase(partyService.getAllActivePartyList(caseDetails)); return GenericAboutToStartOrSubmitCallbackResponse.builder().data(caseData).build(); diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToSubmitHandler.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToSubmitHandler.java index f98aef3058..91f63bb05b 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToSubmitHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToSubmitHandler.java @@ -13,6 +13,7 @@ import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.CaseType; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.FinremCaseData; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.FinremCaseDetails; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.ListForHearingWrapper; import uk.gov.hmcts.reform.finrem.caseorchestration.service.AdditionalHearingDocumentService; import uk.gov.hmcts.reform.finrem.caseorchestration.service.CaseDataService; import uk.gov.hmcts.reform.finrem.caseorchestration.service.GenerateCoverSheetService; @@ -73,11 +74,12 @@ public GenericAboutToStartOrSubmitCallbackResponse handle(Finrem return GenericAboutToStartOrSubmitCallbackResponse.builder().errors(errors).build(); } - if (finremCaseData.getAdditionalListOfHearingDocuments() != null) { - CaseDocument caseDocument = objectMapper.convertValue(finremCaseData.getAdditionalListOfHearingDocuments(), + ListForHearingWrapper listForHearingWrapper = finremCaseData.getListForHearingWrapper(); + if (listForHearingWrapper.getAdditionalListOfHearingDocuments() != null) { + CaseDocument caseDocument = objectMapper.convertValue(listForHearingWrapper.getAdditionalListOfHearingDocuments(), CaseDocument.class); CaseDocument pdfDocument = additionalHearingDocumentService.convertToPdf(caseDocument, userAuthorisation, caseId); - finremCaseData.setAdditionalListOfHearingDocuments(pdfDocument); + listForHearingWrapper.setAdditionalListOfHearingDocuments(pdfDocument); } CaseDetails caseDetails = finremCaseDetailsMapper.mapToCaseDetails(finremCaseDetails); if (hearingDocumentService.alreadyHadFirstHearing(finremCaseDetails)) { diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/FinremCaseData.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/FinremCaseData.java index 3934f13d88..55ef1da3eb 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/FinremCaseData.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/FinremCaseData.java @@ -381,9 +381,6 @@ public class FinremCaseData implements HasCaseDocument { @JsonUnwrapped @Getter(AccessLevel.NONE) private BulkPrintCoversheetWrapper bulkPrintCoversheetWrapper; - private YesOrNo additionalHearingDocumentsOption; - private CaseDocument additionalListOfHearingDocuments; - @JsonProperty("typeOfDocument") private ScannedDocumentTypeOption scannedDocsTypeOfDocument; private List applicantScanDocuments; diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/wrapper/ListForHearingWrapper.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/wrapper/ListForHearingWrapper.java index 26b57df1c4..a7ea3ef663 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/wrapper/ListForHearingWrapper.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/wrapper/ListForHearingWrapper.java @@ -3,15 +3,20 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonUnwrapped; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; +import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; +import lombok.Getter; import lombok.NoArgsConstructor; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.AdditionalHearingDocumentCollection; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.CaseDocument; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.HasCaseDocument; import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.HearingTypeDirection; +import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.YesOrNo; import java.time.LocalDate; import java.util.List; @@ -29,6 +34,12 @@ public class ListForHearingWrapper implements HasCaseDocument { @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") private LocalDate hearingDate; private String hearingTime; + @JsonUnwrapped + @Getter(AccessLevel.NONE) + private HearingRegionWrapper hearingRegionWrapper; private String additionalInformationAboutHearing; + private YesOrNo additionalHearingDocumentsOption; + private CaseDocument additionalListOfHearingDocuments; + private List additionalHearingDocuments; } diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/wrapper/RegionWrapper.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/wrapper/RegionWrapper.java index 558db0ca9a..1993be19ab 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/wrapper/RegionWrapper.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/model/ccd/wrapper/RegionWrapper.java @@ -30,10 +30,6 @@ public class RegionWrapper { @Getter(AccessLevel.NONE) GeneralApplicationRegionWrapper generalApplicationRegionWrapper; - @JsonUnwrapped - @Getter(AccessLevel.NONE) - HearingRegionWrapper hearingRegionWrapper; - @JsonIgnore public AllocatedRegionWrapper getAllocatedRegionWrapper() { if (allocatedRegionWrapper == null) { diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremAdditionalHearingCorresponder.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremAdditionalHearingCorresponder.java index 13be8ec870..dedd0f421d 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremAdditionalHearingCorresponder.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremAdditionalHearingCorresponder.java @@ -47,7 +47,8 @@ public List getCaseDocuments(FinremCaseDetails caseDetails) { documents.add(additionalHearingDocumentCollection.getValue().getDocument()); } - CaseDocument additionalListOfHearingDocuments = caseDetails.getData().getAdditionalListOfHearingDocuments(); + CaseDocument additionalListOfHearingDocuments = caseDetails.getData().getListForHearingWrapper() + .getAdditionalListOfHearingDocuments(); if (additionalListOfHearingDocuments != null) { documents.add(additionalListOfHearingDocuments); } diff --git a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremFormCandGCorresponder.java b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremFormCandGCorresponder.java index 40db7b3ba1..3a26d8b070 100644 --- a/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremFormCandGCorresponder.java +++ b/src/main/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremFormCandGCorresponder.java @@ -42,15 +42,12 @@ private List getHearingCaseDocuments(FinremCaseData caseData, Stri .ifPresent(caseDocuments::add); Optional.ofNullable(caseData.getOutOfFamilyCourtResolution()).ifPresent( caseDocuments::add); - Optional.ofNullable(caseData.getAdditionalListOfHearingDocuments()) + Optional.ofNullable(caseData.getListForHearingWrapper().getAdditionalListOfHearingDocuments()) .ifPresent(caseDocuments::add); - List formACaseDocuments = documentHelper.getFormADocumentsData(caseData); caseDocuments.addAll(formACaseDocuments); return caseDocuments; } - - } diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ContestedListForHearingMidHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ContestedListForHearingMidHandlerTest.java index 9aba420baf..f34a7233e5 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ContestedListForHearingMidHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ContestedListForHearingMidHandlerTest.java @@ -72,17 +72,17 @@ void canNotHandleWrongCallbackType() { @Test - void givenContestedCase_whenListForHearingAdditionalUploadedButNonEncryptedFileShouldNotGetError() throws Exception { + void givenContestedCase_whenListForHearingAdditionalUploadedButNonEncryptedFileShouldNotGetError() { FinremCallbackRequest finremCallbackRequest = buildCallbackRequest(EventType.LIST_FOR_HEARING); FinremCaseData caseData = finremCallbackRequest.getCaseDetails().getData(); CaseDocument caseDocument = TestSetUpUtils.caseDocument(FILE_URL, FILE_NAME, FILE_BINARY_URL); - caseData.setAdditionalHearingDocumentsOption(YesOrNo.YES); - caseData.setAdditionalListOfHearingDocuments(caseDocument); + caseData.getListForHearingWrapper().setAdditionalHearingDocumentsOption(YesOrNo.YES); + caseData.getListForHearingWrapper().setAdditionalListOfHearingDocuments(caseDocument); GenericAboutToStartOrSubmitCallbackResponse response = handler.handle(finremCallbackRequest, AUTH_TOKEN); assertTrue(response.getErrors().isEmpty()); verify(service).validateEncryptionOnUploadedDocument(any(), any(), any(), any()); } -} \ No newline at end of file +} diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToStartHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToStartHandlerTest.java index 58bb429025..f2210a7f7d 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToStartHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/handler/ListForHearingContestedAboutToStartHandlerTest.java @@ -70,7 +70,7 @@ public void givenCase_whenEventStart_thenSetDefaultOptionToNo() { FinremCallbackRequest finremCallbackRequest = buildCallbackRequest(); GenericAboutToStartOrSubmitCallbackResponse response = handler.handle(finremCallbackRequest, AUTH_TOKEN); - assertEquals(YesOrNo.NO, response.getData().getAdditionalHearingDocumentsOption()); + assertEquals(YesOrNo.NO, response.getData().getListForHearingWrapper().getAdditionalHearingDocumentsOption()); } diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremFormCandGCorresponderTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremFormCandGCorresponderTest.java index e2d1124e4f..f31e1356c5 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremFormCandGCorresponderTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/correspondence/hearing/FinremFormCandGCorresponderTest.java @@ -62,6 +62,7 @@ private FinremCaseDetails caseDetails() { FinremCaseData caseData = FinremCaseData.builder() .listForHearingWrapper(ListForHearingWrapper.builder() .hearingDate(LocalDate.parse(DATE_OF_HEARING)) + .additionalListOfHearingDocuments(caseDocument()) .build()) .fastTrackDecision(YesOrNo.forValue(NO_VALUE)) .formC(caseDocument()) @@ -74,7 +75,6 @@ private FinremCaseDetails caseDetails() { .build()) .build())) .outOfFamilyCourtResolution(caseDocument()) - .additionalListOfHearingDocuments(caseDocument()) .build(); return FinremCaseDetails.builder().id(1234L).data(caseData).build(); } diff --git a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/documentchecker/DuplicateFilenameDocumentCheckerTest.java b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/documentchecker/DuplicateFilenameDocumentCheckerTest.java index f1fcdba1c0..25fe468a2a 100644 --- a/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/documentchecker/DuplicateFilenameDocumentCheckerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/service/documentchecker/DuplicateFilenameDocumentCheckerTest.java @@ -910,7 +910,9 @@ static Stream testGetWarningsOnExistingCase() { .outOfFamilyCourtResolution(DUPLICATED_CASE_DOCUMENT) .build()), Arguments.of(FinremCaseData.builder() - .additionalListOfHearingDocuments(DUPLICATED_CASE_DOCUMENT) + .listForHearingWrapper(ListForHearingWrapper.builder() + .additionalListOfHearingDocuments(DUPLICATED_CASE_DOCUMENT) + .build()) .build()), Arguments.of(FinremCaseData.builder() .variationOrderDocument(DUPLICATED_CASE_DOCUMENT)