diff --git a/src/main/java/uk/gov/hmcts/reform/prl/constants/PrlAppsConstants.java b/src/main/java/uk/gov/hmcts/reform/prl/constants/PrlAppsConstants.java index 8917b0ae63f..ae90fcffea7 100644 --- a/src/main/java/uk/gov/hmcts/reform/prl/constants/PrlAppsConstants.java +++ b/src/main/java/uk/gov/hmcts/reform/prl/constants/PrlAppsConstants.java @@ -1153,4 +1153,8 @@ public class PrlAppsConstants { public static final String OPTION_SEND_OR_REPLY = "optionSendOrReply"; public static final String EMPTY_VALUE = "EMPTY_VALUE"; + public static final String APPLICANTS_CONFIDENTIAL_DETAILS = "applicantsConfidentialDetails"; + public static final String RESPONDENT_CONFIDENTIAL_DETAILS = "respondentConfidentialDetails"; + public static final String C100_CHILDREN_CONFIDENTIAL_DETAILS = "childrenConfidentialDetails"; + public static final String FL401_CHILDREN_CONFIDENTIAL_DETAILS = "fl401ChildrenConfidentialDetails"; } diff --git a/src/main/java/uk/gov/hmcts/reform/prl/services/ConfidentialityTabService.java b/src/main/java/uk/gov/hmcts/reform/prl/services/ConfidentialityTabService.java index ea62c18e231..74358d967aa 100644 --- a/src/main/java/uk/gov/hmcts/reform/prl/services/ConfidentialityTabService.java +++ b/src/main/java/uk/gov/hmcts/reform/prl/services/ConfidentialityTabService.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.prl.services; -import com.fasterxml.jackson.databind.ObjectMapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -22,6 +21,7 @@ import uk.gov.hmcts.reform.prl.models.dto.ccd.CaseData; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -31,7 +31,11 @@ import static java.util.Optional.ofNullable; import static org.apache.commons.lang3.ObjectUtils.isNotEmpty; +import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.APPLICANTS_CONFIDENTIAL_DETAILS; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.C100_CASE_TYPE; +import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.C100_CHILDREN_CONFIDENTIAL_DETAILS; +import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.FL401_CHILDREN_CONFIDENTIAL_DETAILS; +import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESPONDENT_CONFIDENTIAL_DETAILS; import static uk.gov.hmcts.reform.prl.enums.FL401OrderTypeEnum.occupationOrder; import static uk.gov.hmcts.reform.prl.utils.ElementUtils.unwrapElements; @@ -40,69 +44,12 @@ @RequiredArgsConstructor(onConstructor = @__(@Autowired)) public class ConfidentialityTabService { - private final ObjectMapper objectMapper; - public Map updateConfidentialityDetails(CaseData caseData) { - - List> applicantsConfidentialDetails = new ArrayList<>(); - List> respondentsConfidentialDetails = new ArrayList<>(); - if (C100_CASE_TYPE.equalsIgnoreCase(caseData.getCaseTypeOfApplication())) { - Optional>> applicantList = ofNullable(caseData.getApplicants()); - if (applicantList.isPresent()) { - List applicants = caseData.getApplicants().stream() - .map(Element::getValue) - .toList(); - applicantsConfidentialDetails = getConfidentialApplicantDetails( - applicants); - } - - List> childrenConfidentialDetails = getChildrenConfidentialDetails(caseData); - - Optional>> respondentList = ofNullable(caseData.getRespondents()); - if (respondentList.isPresent()) { - List respondents = caseData.getRespondents().stream() - .map(Element::getValue) - .toList(); - respondentsConfidentialDetails = getConfidentialApplicantDetails( - respondents); - } - - return Map.of( - "applicantsConfidentialDetails", - applicantsConfidentialDetails, - "childrenConfidentialDetails", - childrenConfidentialDetails, - "respondentConfidentialDetails", - respondentsConfidentialDetails - ); - + return getC100ConfidentialityDetails(caseData); } else { - if (null != caseData.getApplicantsFL401()) { - List fl401Applicant = List.of(caseData.getApplicantsFL401()); - applicantsConfidentialDetails = getConfidentialApplicantDetails( - fl401Applicant); - } - - if (null != caseData.getRespondentsFL401()) { - List fl401Respondent = List.of(caseData.getRespondentsFL401()); - respondentsConfidentialDetails = getConfidentialApplicantDetails( - fl401Respondent); - } - - List> childrenConfidentialDetails = getFl401ChildrenConfidentialDetails(caseData); - - return Map.of( - "applicantsConfidentialDetails", - applicantsConfidentialDetails, - "fl401ChildrenConfidentialDetails", - childrenConfidentialDetails, - "respondentConfidentialDetails", - respondentsConfidentialDetails - ); - + return getFL401ConfidentialityDetails(caseData); } - } public List> getChildrenConfidentialDetails(CaseData caseData) { @@ -125,7 +72,6 @@ public List> getChildrenConfidentialDetails return elementList; } - public List> getChildrenConfidentialDetails(List children) { List> childrenConfidentialDetails = new ArrayList<>(); for (Child child : children) { @@ -374,5 +320,64 @@ public List> updateOtherPeopleConfidentiality(List null); } -} + private Map getC100ConfidentialityDetails(CaseData caseData) { + List> applicantsConfidentialDetails = getApplicantConfidentialDetails(caseData); + List> respondentsConfidentialDetails = getRespondentConfidentialDetails(caseData); + List> childrenConfidentialDetails = getChildrenConfidentialDetails(caseData); + + return Map.of( + APPLICANTS_CONFIDENTIAL_DETAILS, applicantsConfidentialDetails, + C100_CHILDREN_CONFIDENTIAL_DETAILS, childrenConfidentialDetails, + RESPONDENT_CONFIDENTIAL_DETAILS, respondentsConfidentialDetails + ); + } + + private Map getFL401ConfidentialityDetails(CaseData caseData) { + List> applicantsConfidentialDetails = new ArrayList<>(); + List> respondentsConfidentialDetails = new ArrayList<>(); + + if (null != caseData.getApplicantsFL401()) { + List fl401Applicant = List.of(caseData.getApplicantsFL401()); + applicantsConfidentialDetails = getConfidentialApplicantDetails(fl401Applicant); + } + + if (null != caseData.getRespondentsFL401()) { + List fl401Respondent = List.of(caseData.getRespondentsFL401()); + respondentsConfidentialDetails = getConfidentialApplicantDetails( + fl401Respondent); + } + + List> childrenConfidentialDetails = getFl401ChildrenConfidentialDetails(caseData); + + return Map.of( + APPLICANTS_CONFIDENTIAL_DETAILS, applicantsConfidentialDetails, + FL401_CHILDREN_CONFIDENTIAL_DETAILS, childrenConfidentialDetails, + RESPONDENT_CONFIDENTIAL_DETAILS, respondentsConfidentialDetails + ); + } + + private List> getApplicantConfidentialDetails(CaseData caseData) { + Optional>> applicantList = ofNullable(caseData.getApplicants()); + if (applicantList.isPresent()) { + List applicants = caseData.getApplicants().stream() + .map(Element::getValue) + .toList(); + return getConfidentialApplicantDetails(applicants); + } else { + return Collections.emptyList(); + } + } + + private List> getRespondentConfidentialDetails(CaseData caseData) { + Optional>> respondentList = ofNullable(caseData.getRespondents()); + if (respondentList.isPresent()) { + List respondents = caseData.getRespondents().stream() + .map(Element::getValue) + .toList(); + return getConfidentialApplicantDetails(respondents); + } else { + return Collections.emptyList(); + } + } +} diff --git a/src/main/java/uk/gov/hmcts/reform/prl/services/UpdatePartyDetailsService.java b/src/main/java/uk/gov/hmcts/reform/prl/services/UpdatePartyDetailsService.java index 19908e3adfd..ce0d3ad64d2 100644 --- a/src/main/java/uk/gov/hmcts/reform/prl/services/UpdatePartyDetailsService.java +++ b/src/main/java/uk/gov/hmcts/reform/prl/services/UpdatePartyDetailsService.java @@ -72,6 +72,7 @@ import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.REFUGE_DOCUMENTS; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESPONDENT; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESPONDENTS; +import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESPONDENT_CONFIDENTIAL_DETAILS; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.SOLICITOR; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.TASK_LIST_VERSION_V2; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.TASK_LIST_VERSION_V3; @@ -91,7 +92,6 @@ @Slf4j public class UpdatePartyDetailsService { - public static final String RESPONDENT_CONFIDENTIAL_DETAILS = "respondentConfidentialDetails"; protected static final String[] HISTORICAL_DOC_TO_RETAIN_FOR_EVENTS = {CaseEvent.AMEND_APPLICANTS_DETAILS.getValue(), CaseEvent.AMEND_RESPONDENTS_DETAILS.getValue(), CaseEvent.AMEND_OTHER_PEOPLE_IN_THE_CASE_REVISED.getValue()}; public static final String C_8_OF = "C8 of "; diff --git a/src/main/java/uk/gov/hmcts/reform/prl/services/c100respondentsolicitor/C100RespondentSolicitorService.java b/src/main/java/uk/gov/hmcts/reform/prl/services/c100respondentsolicitor/C100RespondentSolicitorService.java index c78db92703a..374a06a1701 100644 --- a/src/main/java/uk/gov/hmcts/reform/prl/services/c100respondentsolicitor/C100RespondentSolicitorService.java +++ b/src/main/java/uk/gov/hmcts/reform/prl/services/c100respondentsolicitor/C100RespondentSolicitorService.java @@ -109,6 +109,7 @@ import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.LONDON_TIME_ZONE; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.NEW_CHILDREN; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESPONDENT; +import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESPONDENT_CONFIDENTIAL_DETAILS; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESP_CHILD_ABUSES_DOCMOSIS; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.SOLICITOR_C1A_DRAFT_DOCUMENT; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.SOLICITOR_C1A_FINAL_DOCUMENT; @@ -146,7 +147,6 @@ public class C100RespondentSolicitorService { public static final String RESPONSE_ALREADY_SUBMITTED_ERROR = "This event cannot be started as the response has already been submitted."; public static final String SOLICITOR = " (Solicitor)"; public static final String RESPONDENT_DOCS_LIST = "respondentDocsList"; - public static final String RESPONDENT_CONFIDENTIAL_DETAILS = "respondentConfidentialDetails"; public static final String IS_CONFIDENTIAL_DATA_PRESENT = "isConfidentialDataPresent"; public static final String EMAIL = "email"; public static final String PHONE = "phone"; diff --git a/src/test/java/uk/gov/hmcts/reform/prl/services/ConfidentialityTabServiceTest.java b/src/test/java/uk/gov/hmcts/reform/prl/services/ConfidentialityTabServiceTest.java index a0071c1e387..958bb768ebb 100644 --- a/src/test/java/uk/gov/hmcts/reform/prl/services/ConfidentialityTabServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/prl/services/ConfidentialityTabServiceTest.java @@ -1,13 +1,10 @@ package uk.gov.hmcts.reform.prl.services; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.Before; -import org.junit.Test; import org.junit.jupiter.api.Assertions; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import uk.gov.hmcts.reform.prl.enums.FL401OrderTypeEnum; import uk.gov.hmcts.reform.prl.enums.Gender; import uk.gov.hmcts.reform.prl.enums.RelationshipsEnum; @@ -39,9 +36,9 @@ import java.util.Map; import java.util.UUID; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.C100_CASE_TYPE; import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.FL401_CASE_TYPE; @@ -49,15 +46,11 @@ import static uk.gov.hmcts.reform.prl.enums.OrderTypeEnum.childArrangementsOrder; import static uk.gov.hmcts.reform.prl.utils.ElementUtils.element; -@RunWith(MockitoJUnitRunner.class) -public class ConfidentialityTabServiceTest { +@ExtendWith(MockitoExtension.class) +class ConfidentialityTabServiceTest { - @InjectMocks ConfidentialityTabService confidentialityTabService; - @Mock - ObjectMapper objectMapper; - Address address; PartyDetails partyDetails1; PartyDetails partyDetails2; @@ -65,8 +58,9 @@ public class ConfidentialityTabServiceTest { PartyDetails refugePartyDetails1; PartyDetails refugePartyDetails2; - @Before - public void setUp() { + @BeforeEach + void setUp() { + confidentialityTabService = new ConfidentialityTabService(); address = Address.builder() .addressLine1("AddressLine1") @@ -77,7 +71,7 @@ public void setUp() { refugePartyDetails1 = PartyDetails.builder() .firstName("ABC 1") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.Yes) @@ -95,7 +89,7 @@ public void setUp() { refugePartyDetails2 = PartyDetails.builder() .firstName("ABC 2") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.No) @@ -112,12 +106,12 @@ public void setUp() { } @Test - public void testApplicantConfidentialDetails() { + void testApplicantConfidentialDetails() { partyDetails1 = PartyDetails.builder() .firstName("ABC 1") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.Yes) @@ -131,7 +125,7 @@ public void testApplicantConfidentialDetails() { partyDetails2 = PartyDetails.builder() .firstName("ABC 2") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.No) @@ -158,12 +152,12 @@ public void testApplicantConfidentialDetails() { } @Test - public void testApplicantConfidentialDetailsWhenNull() { + void testApplicantConfidentialDetailsWhenNull() { partyDetails1 = PartyDetails.builder() .firstName("ABC 1") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.Yes) @@ -186,12 +180,10 @@ public void testApplicantConfidentialDetailsWhenNull() { expectedOutput, confidentialityTabService.getConfidentialApplicantDetails(List.of(partyDetails1)) ); - } - @Test - public void testChildConfidentialDetailsV2() { + void testChildConfidentialDetailsV2() { ChildrenAndApplicantRelation childrenAndApplicantRelation = ChildrenAndApplicantRelation.builder() .applicantFullName("Test") @@ -262,8 +254,6 @@ public void testChildConfidentialDetailsV2() { List> childrenAndRespondentRelationList = Collections.singletonList(childrenAndRespondentRelationElement); - - CaseData caseData = CaseData.builder() .taskListVersion("v2") .newChildDetails(listOfChildren) @@ -278,15 +268,13 @@ public void testChildConfidentialDetailsV2() { .otherPartyInTheCaseRevised(List.of(partyWrapped)) .build(); - assertNotNull( confidentialityTabService.getChildrenConfidentialDetails(caseData) ); } - @Test - public void testChildConfidentialDetails() { + void testChildConfidentialDetails() { OtherPersonWhoLivesWithChild personWhoLivesWithChild1 = OtherPersonWhoLivesWithChild.builder() .isPersonIdentityConfidential(YesOrNo.Yes).relationshipToChildDetails("test") .firstName("Confidential First Name").lastName("Confidential Last Name").address(address).build(); @@ -310,7 +298,6 @@ public void testChildConfidentialDetails() { .personWhoLivesWithChild(listOfOtherPersonsWhoLivedWithChild) .build(); - List listOfChildren = Collections.singletonList(child); List> expectedOutput = List.of( Element.builder() @@ -335,12 +322,12 @@ public void testChildConfidentialDetails() { } @Test - public void testChildAndPartyConfidentialDetails() { + void testChildAndPartyConfidentialDetails() { partyDetails1 = PartyDetails.builder() .firstName("ABC 1") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.Yes) @@ -354,7 +341,7 @@ public void testChildAndPartyConfidentialDetails() { partyDetails2 = PartyDetails.builder() .firstName("ABC 2") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.No) @@ -365,8 +352,6 @@ public void testChildAndPartyConfidentialDetails() { .email("abc2@xyz.com") .build(); - - OtherPersonWhoLivesWithChild personWhoLivesWithChild1 = OtherPersonWhoLivesWithChild.builder() .isPersonIdentityConfidential(YesOrNo.Yes).relationshipToChildDetails("test") .firstName("Confidential First Name").lastName("Confidential Last Name").address(address).build(); @@ -417,11 +402,10 @@ public void testChildAndPartyConfidentialDetails() { assertTrue(stringObjectMap.containsKey("applicantsConfidentialDetails")); assertTrue(stringObjectMap.containsKey("childrenConfidentialDetails")); - } @Test - public void testFl401ChildConfidentialDetails() { + void testFl401ChildConfidentialDetails() { ChildrenLiveAtAddress child = ChildrenLiveAtAddress.builder() .childFullName("Test") .keepChildrenInfoConfidential(YesOrNo.Yes) @@ -446,7 +430,6 @@ public void testFl401ChildConfidentialDetails() { .build()) .build(); - assertEquals( expectedOutput, confidentialityTabService.getFl401ChildrenConfidentialDetails(caseData) @@ -454,7 +437,7 @@ public void testFl401ChildConfidentialDetails() { } @Test - public void shouldAllowFl401KeepChildrenInfoConfidentialToBeNull() { + void shouldAllowFl401KeepChildrenInfoConfidentialToBeNull() { ChildrenLiveAtAddress child = ChildrenLiveAtAddress.builder() .childFullName("Test") .keepChildrenInfoConfidential(null) @@ -482,12 +465,12 @@ public void shouldAllowFl401KeepChildrenInfoConfidentialToBeNull() { } @Test - public void testChildAndPartyConfidentialDetailsFl401() { + void testChildAndPartyConfidentialDetailsFl401() { partyDetails1 = PartyDetails.builder() .firstName("ABC 1") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.Yes) @@ -498,7 +481,6 @@ public void testChildAndPartyConfidentialDetailsFl401() { .isEmailAddressConfidential(YesOrNo.Yes) .build(); - ChildrenLiveAtAddress child = ChildrenLiveAtAddress.builder() .childFullName("Test") .keepChildrenInfoConfidential(YesOrNo.Yes) @@ -527,11 +509,10 @@ public void testChildAndPartyConfidentialDetailsFl401() { assertTrue(stringObjectMap.containsKey("applicantsConfidentialDetails")); assertTrue(stringObjectMap.containsKey("fl401ChildrenConfidentialDetails")); - } @Test - public void testApplicantConfidentialDetailsWhenNoApplicantsPresent() { + void testApplicantConfidentialDetailsWhenNoApplicantsPresent() { CaseData caseData = CaseData.builder() .applicants(null) @@ -543,11 +524,10 @@ public void testApplicantConfidentialDetailsWhenNoApplicantsPresent() { assertTrue(stringObjectMap.containsKey("childrenConfidentialDetails")); assertEquals(Collections.EMPTY_LIST,stringObjectMap.get("applicantsConfidentialDetails")); assertEquals(Collections.EMPTY_LIST,stringObjectMap.get("childrenConfidentialDetails")); - } @Test - public void testApplicantConfidentialDetailsWhenNoFL401ApplicantsPresent() { + void testApplicantConfidentialDetailsWhenNoFL401ApplicantsPresent() { ChildrenLiveAtAddress child = ChildrenLiveAtAddress.builder() .childFullName("Test") @@ -576,16 +556,15 @@ public void testApplicantConfidentialDetailsWhenNoFL401ApplicantsPresent() { assertEquals(Collections.EMPTY_LIST,stringObjectMap.get("applicantsConfidentialDetails")); assertTrue(stringObjectMap.containsKey("fl401ChildrenConfidentialDetails")); - } @Test - public void testRefugeApplicantConfidentialDetails() { + void testRefugeApplicantConfidentialDetails() { refugePartyDetails1 = refugePartyDetails1.toBuilder() .firstName("ABC 1") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.Yes) @@ -599,7 +578,7 @@ public void testRefugeApplicantConfidentialDetails() { refugePartyDetails2 = refugePartyDetails2.toBuilder() .firstName("ABC 2") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.No) @@ -632,16 +611,15 @@ public void testRefugeApplicantConfidentialDetails() { expectedOutput, confidentialityTabService.getConfidentialApplicantDetails(List.of(refugePartyDetails1, refugePartyDetails2)) ); - } @Test - public void testGetChildrenConfidentialDetailsV2() { + void testGetChildrenConfidentialDetailsV2() { partyDetails1 = PartyDetails.builder() .firstName("ABC 1") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.Yes) @@ -656,8 +634,6 @@ public void testGetChildrenConfidentialDetailsV2() { partyDetails1).build(); List> otherPartyList = List.of(partyDetailsFirstRec); - - // Mock data ChildrenAndOtherPeopleRelation relation = ChildrenAndOtherPeopleRelation.builder() .childFullName("test").otherPeopleFullName("test").otherPeopleId("00000000-0000-0000-0000-000000000000") @@ -678,20 +654,20 @@ public void testGetChildrenConfidentialDetailsV2() { List> result = confidentialityTabService.getChildrenConfidentialDetailsV2(caseData); // Assertions - Assertions.assertEquals(1, result.size()); - ChildConfidentialityDetails details = result.get(0).getValue(); + assertEquals(1, result.size()); + ChildConfidentialityDetails details = result.getFirst().getValue(); assertEquals("ChildFirstName", details.getFirstName()); assertEquals("ChildLastName", details.getLastName()); assertEquals(1, details.getOtherPerson().size()); } @Test - public void testGetChildrenConfidentialDetailsV2_scenario2() { + void testGetChildrenConfidentialDetailsV2_scenario2() { partyDetails1 = PartyDetails.builder() .firstName("ABC 1") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.Yes) @@ -706,8 +682,6 @@ public void testGetChildrenConfidentialDetailsV2_scenario2() { partyDetails1).build(); List> otherPartyList = List.of(partyDetailsFirstRec); - - // Mock data ChildrenAndOtherPeopleRelation relation = ChildrenAndOtherPeopleRelation.builder() .childFullName("test").otherPeopleFullName("test").otherPeopleId("00000000-0000-0000-0000-000000000000") @@ -728,11 +702,11 @@ public void testGetChildrenConfidentialDetailsV2_scenario2() { List> result = confidentialityTabService.getChildrenConfidentialDetailsV2(caseData); // Assertions - Assertions.assertEquals(0, result.size()); + assertEquals(0, result.size()); } @Test - public void testUpdateOtherPeopleConfidentiality_withConfidentialRelations() { + void testUpdateOtherPeopleConfidentiality_withConfidentialRelations() { // Mock data ChildrenAndOtherPeopleRelation relation = ChildrenAndOtherPeopleRelation.builder() .childFullName("test").otherPeopleFullName("test").otherPeopleId("00000000-0000-0000-0000-000000000000") @@ -744,7 +718,7 @@ public void testUpdateOtherPeopleConfidentiality_withConfidentialRelations() { partyDetails1 = PartyDetails.builder() .firstName("ABC 1") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.Yes) @@ -766,15 +740,15 @@ public void testUpdateOtherPeopleConfidentiality_withConfidentialRelations() { List> result = confidentialityTabService.updateOtherPeopleConfidentiality(relations, otherPartyList); // Assertions - Assertions.assertEquals(1, result.size()); - PartyDetails updatedPartyDetails = result.get(0).getValue(); - Assertions.assertEquals(YesOrNo.Yes, updatedPartyDetails.getIsAddressConfidential()); - Assertions.assertEquals(YesOrNo.Yes, updatedPartyDetails.getIsPhoneNumberConfidential()); - Assertions.assertEquals(YesOrNo.Yes, updatedPartyDetails.getIsEmailAddressConfidential()); + assertEquals(1, result.size()); + PartyDetails updatedPartyDetails = result.getFirst().getValue(); + assertEquals(YesOrNo.Yes, updatedPartyDetails.getIsAddressConfidential()); + assertEquals(YesOrNo.Yes, updatedPartyDetails.getIsPhoneNumberConfidential()); + assertEquals(YesOrNo.Yes, updatedPartyDetails.getIsEmailAddressConfidential()); } @Test - public void testUpdateOtherPeopleConfidentiality_withoutConfidentialRelations() { + void testUpdateOtherPeopleConfidentiality_withoutConfidentialRelations() { // Mock data ChildrenAndOtherPeopleRelation relation = ChildrenAndOtherPeopleRelation.builder() .childFullName("test").otherPeopleFullName("test").otherPeopleId("00000000-0000-0000-0000-000000000000") @@ -786,7 +760,7 @@ public void testUpdateOtherPeopleConfidentiality_withoutConfidentialRelations() partyDetails1 = PartyDetails.builder() .firstName("ABC 1") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.Yes) @@ -808,20 +782,20 @@ public void testUpdateOtherPeopleConfidentiality_withoutConfidentialRelations() List> result = confidentialityTabService.updateOtherPeopleConfidentiality(relations, otherPartyList); // Assertions - Assertions.assertEquals(1, result.size()); - PartyDetails updatedPartyDetails = result.get(0).getValue(); - Assertions.assertEquals(YesOrNo.No, updatedPartyDetails.getIsAddressConfidential()); - Assertions.assertEquals(YesOrNo.No, updatedPartyDetails.getIsPhoneNumberConfidential()); - Assertions.assertEquals(YesOrNo.No, updatedPartyDetails.getIsEmailAddressConfidential()); + assertEquals(1, result.size()); + PartyDetails updatedPartyDetails = result.getFirst().getValue(); + assertEquals(YesOrNo.No, updatedPartyDetails.getIsAddressConfidential()); + assertEquals(YesOrNo.No, updatedPartyDetails.getIsPhoneNumberConfidential()); + assertEquals(YesOrNo.No, updatedPartyDetails.getIsEmailAddressConfidential()); } @Test - public void testUpdateOtherPeopleConfidentiality_withEmptyRelations() { + void testUpdateOtherPeopleConfidentiality_withEmptyRelations() { // Mock data partyDetails1 = PartyDetails.builder() .firstName("ABC 1") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.Yes) @@ -842,20 +816,20 @@ public void testUpdateOtherPeopleConfidentiality_withEmptyRelations() { List> result = confidentialityTabService.updateOtherPeopleConfidentiality(relations, otherPartyList); // Assertions - Assertions.assertEquals(1, result.size()); - PartyDetails updatedPartyDetails = result.get(0).getValue(); - Assertions.assertEquals(YesOrNo.No, updatedPartyDetails.getIsAddressConfidential()); - Assertions.assertEquals(YesOrNo.No, updatedPartyDetails.getIsPhoneNumberConfidential()); - Assertions.assertEquals(YesOrNo.No, updatedPartyDetails.getIsEmailAddressConfidential()); + assertEquals(1, result.size()); + PartyDetails updatedPartyDetails = result.getFirst().getValue(); + assertEquals(YesOrNo.No, updatedPartyDetails.getIsAddressConfidential()); + assertEquals(YesOrNo.No, updatedPartyDetails.getIsPhoneNumberConfidential()); + assertEquals(YesOrNo.No, updatedPartyDetails.getIsEmailAddressConfidential()); } @Test - public void testUpdateOtherPeopleConfidentiality_withNullRelations() { + void testUpdateOtherPeopleConfidentiality_withNullRelations() { // Mock data partyDetails1 = PartyDetails.builder() .firstName("ABC 1") .lastName("XYZ 2") - .dateOfBirth(LocalDate.of(2000, 01, 01)) + .dateOfBirth(LocalDate.of(2000, 1, 1)) .gender(Gender.male) .address(address) .canYouProvideEmailAddress(YesOrNo.Yes) @@ -874,15 +848,15 @@ public void testUpdateOtherPeopleConfidentiality_withNullRelations() { List> result = confidentialityTabService.updateOtherPeopleConfidentiality(null, otherPartyList); // Assertions - Assertions.assertEquals(1, result.size()); - PartyDetails updatedPartyDetails = result.get(0).getValue(); - Assertions.assertEquals(YesOrNo.No, updatedPartyDetails.getIsAddressConfidential()); - Assertions.assertEquals(YesOrNo.No, updatedPartyDetails.getIsPhoneNumberConfidential()); - Assertions.assertEquals(YesOrNo.No, updatedPartyDetails.getIsEmailAddressConfidential()); + assertEquals(1, result.size()); + PartyDetails updatedPartyDetails = result.getFirst().getValue(); + assertEquals(YesOrNo.No, updatedPartyDetails.getIsAddressConfidential()); + assertEquals(YesOrNo.No, updatedPartyDetails.getIsPhoneNumberConfidential()); + assertEquals(YesOrNo.No, updatedPartyDetails.getIsEmailAddressConfidential()); } @Test - public void testUpdateOtherPeopleConfidentiality_withNullOtherPartyList() { + void testUpdateOtherPeopleConfidentiality_withNullOtherPartyList() { // Mock data ChildrenAndOtherPeopleRelation relation = mock(ChildrenAndOtherPeopleRelation.class); @@ -894,6 +868,4 @@ public void testUpdateOtherPeopleConfidentiality_withNullOtherPartyList() { // Assertions Assertions.assertNull(result); } - - } diff --git a/src/test/java/uk/gov/hmcts/reform/prl/services/UpdatePartyDetailsServiceTest.java b/src/test/java/uk/gov/hmcts/reform/prl/services/UpdatePartyDetailsServiceTest.java index c92eac36580..77e76b5aef3 100644 --- a/src/test/java/uk/gov/hmcts/reform/prl/services/UpdatePartyDetailsServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/prl/services/UpdatePartyDetailsServiceTest.java @@ -54,9 +54,10 @@ import java.util.Map; import java.util.UUID; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyMap; import static org.mockito.ArgumentMatchers.anyString; @@ -78,49 +79,37 @@ @Slf4j @ExtendWith(MockitoExtension.class) -public class UpdatePartyDetailsServiceTest { +class UpdatePartyDetailsServiceTest { - public static final String BEARER_TOKEN = "Bearer token"; + private static final String BEARER_TOKEN = "Bearer token"; + + @InjectMocks + UpdatePartyDetailsService updatePartyDetailsService; @Mock NoticeOfChangePartiesService noticeOfChangePartiesService; - @Mock ObjectMapper objectMapper; - @Mock ConfidentialDetailsMapper confidentialDetailsMapper; - @Mock C100RespondentSolicitorService c100RespondentSolicitorService; - @Mock DocumentLanguageService documentLanguageService; - @Mock DocumentGenService documentGenService; - @Mock PartyLevelCaseFlagsService partyLevelCaseFlagsService; - @Mock @Qualifier("caseSummaryTab") CaseSummaryTabService caseSummaryTabService; - @Mock ConfidentialityTabService confidentialityTabService; - @Mock ConfidentialityC8RefugeService confidentialityC8RefugeService; - - @InjectMocks - UpdatePartyDetailsService updatePartyDetailsService; - @Mock ManageOrderService manageOrderService; - @Mock C8ArchiveService c8ArchiveService; - @Mock CaseNameService caseNameService; @@ -828,8 +817,6 @@ void updateApplicantAndChildNamesFL401() { .build()) .build(); - Map nocMap = Map.of("some", "stuff"); - when(confidentialDetailsMapper.mapConfidentialData( Mockito.any(CaseData.class), Mockito.anyBoolean() @@ -887,12 +874,9 @@ void updateApplicantAndChildNamesFl401() { .build()) .build(); - Map nocMap = Map.of("some", "stuff"); - updatePartyDetailsService.updateApplicantRespondentAndChildData(callbackRequest, BEARER_TOKEN); assertEquals("test1 test22", caseDataUpdated.get("applicantName")); assertEquals("test1 test22", caseDataUpdated.get("respondentName")); - } @Test @@ -970,7 +954,6 @@ void testCaseFlagFl401() { .build()) .build(); - Map nocMap = Map.of("some", "stuff"); when(confidentialDetailsMapper.mapConfidentialData( Mockito.any(CaseData.class), Mockito.anyBoolean() @@ -998,7 +981,6 @@ void testCaseFlagFl401() { assertEquals("resp party", respondentsFL401.getPartyLevelFlag().getPartyName()); } - @Test void testCaseFlagApplicantsC100() { @@ -1107,10 +1089,8 @@ void testCaseFlagApplicantsC100() { assertNotNull(caseDataUpdated.get("applicants")); } - @Test void testCaseFlagRespondentsC100() { - Map caseDataUpdated = new HashMap<>(); caseDataUpdated.put("applicantName", "test1 test22"); caseDataUpdated.put("respondentName", "respondent2 lastname222"); @@ -1153,7 +1133,6 @@ void testCaseFlagRespondentsC100() { Element wrappedChildren = Element.builder().value(child).build(); List> listOfChildren = Collections.singletonList(wrappedChildren); - CaseData caseData = CaseData.builder() .caseTypeOfApplication(PrlAppsConstants.C100_CASE_TYPE) .respondents(respondentList) @@ -1187,14 +1166,13 @@ void testCaseFlagRespondentsC100() { .build()) .caseDetailsBefore(CaseDetails.builder().id(123L).data(stringObjectMap).build()) .build(); - DocumentLanguage documentLanguage = DocumentLanguage.builder().isGenEng(true).isGenWelsh(true).build(); - updatePartyDetailsService.updateApplicantRespondentAndChildData(callbackRequest, BEARER_TOKEN); - assertNotNull("respondents"); + Map updatedCaseData = updatePartyDetailsService.updateApplicantRespondentAndChildData( + callbackRequest, BEARER_TOKEN); + assertNotNull(updatedCaseData.get("respondents")); } @Test - void testC8GenerateForRespondentsC100() throws Exception { - + void testC8GenerateForRespondentsC100() { Map caseDataUpdated = new HashMap<>(); caseDataUpdated.put("applicantName", "test1 test22"); caseDataUpdated.put("respondentName", "respondent2 lastname222"); @@ -1269,13 +1247,13 @@ void testC8GenerateForRespondentsC100() throws Exception { .data(stringObjectMap) .build()) .build(); - updatePartyDetailsService.updateApplicantRespondentAndChildData(callbackRequest, BEARER_TOKEN); - assertNotNull("respondents"); + Map updatedCaseData = updatePartyDetailsService.updateApplicantRespondentAndChildData( + callbackRequest, BEARER_TOKEN); + assertNotNull(updatedCaseData.get("respondents")); } @Test void testC8GenerateForSixRespondentsC100() throws Exception { - Map caseDataUpdated = new HashMap<>(); caseDataUpdated.put("applicantName", "test1 test22"); caseDataUpdated.put("respondentName", "respondent2 lastname222"); @@ -1469,11 +1447,11 @@ void testC8GenerateForSixRespondentsC100() throws Exception { .build(); DocumentLanguage documentLanguage = DocumentLanguage.builder().isGenEng(true).isGenWelsh(true).build(); when(documentLanguageService.docGenerateLang(Mockito.any(CaseData.class))).thenReturn(documentLanguage); - updatePartyDetailsService.updateApplicantRespondentAndChildData(callbackRequest, BEARER_TOKEN); - assertNotNull("respondents"); + Map updatedCaseData = updatePartyDetailsService.updateApplicantRespondentAndChildData( + callbackRequest, BEARER_TOKEN); + assertNotNull(updatedCaseData.get("respondents")); } - @Test void testCheckIfConfidentialityDetailsChangedRespondentWhenRespondentsDoNotExist() { // given @@ -1496,7 +1474,7 @@ void testCheckIfConfidentialityDetailsChangedRespondentWhenRespondentsDoNotExist ); // then - assertEquals(false, bool); + assertFalse(bool); } @Test @@ -1512,15 +1490,6 @@ void checkIfDetailsChangedFl401All() { .caseTypeOfApplication("FL401") .respondentsFL401(respondentBefore) .build(); - Map objectMap = new HashMap<>(); - CallbackRequest callbackRequest = CallbackRequest.builder() - .caseDetailsBefore(CaseDetails - .builder() - .state(State.CASE_ISSUED.getValue()) - .data(objectMap) - .build()) - .build(); - Map stringObjectMap = callbackRequest.getCaseDetailsBefore().getData(); PartyDetails respondent = PartyDetails.builder() .email("test1") .address(Address.builder() @@ -1533,7 +1502,7 @@ void checkIfDetailsChangedFl401All() { caseDataBefore, wrappedRespondent ); - assertEquals(true, bool); + assertTrue(bool); } @Test @@ -1545,15 +1514,6 @@ void checkIfDetailsChangedFl401EmailOnly() { .caseTypeOfApplication("FL401") .respondentsFL401(respondentBefore) .build(); - Map objectMap = new HashMap<>(); - CallbackRequest callbackRequest = CallbackRequest.builder() - .caseDetailsBefore(CaseDetails - .builder() - .state(State.CASE_ISSUED.getValue()) - .data(objectMap) - .build()) - .build(); - Map stringObjectMap = callbackRequest.getCaseDetailsBefore().getData(); PartyDetails respondent = PartyDetails.builder() .email("test1") .build(); @@ -1562,7 +1522,7 @@ void checkIfDetailsChangedFl401EmailOnly() { caseDataBefore, wrappedRespondent ); - assertEquals(true, bool); + assertTrue(bool); } @Test @@ -1576,15 +1536,6 @@ void checkIfDetailsChangedFl401AddressOnly() { .caseTypeOfApplication("FL401") .respondentsFL401(respondentBefore) .build(); - Map objectMap = new HashMap<>(); - CallbackRequest callbackRequest = CallbackRequest.builder() - .caseDetailsBefore(CaseDetails - .builder() - .state(State.CASE_ISSUED.getValue()) - .data(objectMap) - .build()) - .build(); - Map stringObjectMap = callbackRequest.getCaseDetailsBefore().getData(); PartyDetails respondent = PartyDetails.builder() .address(Address.builder() .addressLine1("test1") @@ -1595,7 +1546,7 @@ void checkIfDetailsChangedFl401AddressOnly() { caseDataBefore, wrappedRespondent ); - assertEquals(true, bool); + assertTrue(bool); } @Test @@ -1607,15 +1558,6 @@ void checkIfDetailsChangedPhoneOnly() { .caseTypeOfApplication("FL401") .respondentsFL401(respondentBefore) .build(); - Map objectMap = new HashMap<>(); - CallbackRequest callbackRequest = CallbackRequest.builder() - .caseDetailsBefore(CaseDetails - .builder() - .state(State.CASE_ISSUED.getValue()) - .data(objectMap) - .build()) - .build(); - Map stringObjectMap = callbackRequest.getCaseDetailsBefore().getData(); PartyDetails respondent = PartyDetails.builder() .phoneNumber("012345") .build(); @@ -1624,7 +1566,7 @@ void checkIfDetailsChangedPhoneOnly() { caseDataBefore, wrappedRespondent ); - assertEquals(true, bool); + assertTrue(bool); } @Test @@ -1635,15 +1577,6 @@ void checkIfDetailsChangedFl401NoChange() { .caseTypeOfApplication("FL401") .respondentsFL401(respondentBefore) .build(); - Map objectMap = new HashMap<>(); - CallbackRequest callbackRequest = CallbackRequest.builder() - .caseDetailsBefore(CaseDetails - .builder() - .state(State.CASE_ISSUED.getValue()) - .data(objectMap) - .build()) - .build(); - Map stringObjectMap = callbackRequest.getCaseDetailsBefore().getData(); PartyDetails respondent = PartyDetails.builder() .build(); Element wrappedRespondent = Element.builder().value(respondent).build(); @@ -1651,7 +1584,7 @@ void checkIfDetailsChangedFl401NoChange() { caseDataBefore, wrappedRespondent ); - assertEquals(false, bool); + assertFalse(bool); } @Test @@ -1671,15 +1604,6 @@ void checkIfDetailsChangedC100All() { .caseTypeOfApplication("C100") .respondents(listOfRespondents) .build(); - Map objectMap = new HashMap<>(); - CallbackRequest callbackRequest = CallbackRequest.builder() - .caseDetailsBefore(CaseDetails - .builder() - .state(State.CASE_ISSUED.getValue()) - .data(objectMap) - .build()) - .build(); - Map stringObjectMap = callbackRequest.getCaseDetailsBefore().getData(); respondentBefore = respondentBefore.toBuilder() .email("test1") .address(Address.builder() @@ -1692,7 +1616,7 @@ void checkIfDetailsChangedC100All() { caseDataBefore, wrappedRespondent ); - assertEquals(true, bool); + assertTrue(bool); } @Test @@ -1708,15 +1632,6 @@ void checkIfDetailsChangedC100EmailOnly() { .caseTypeOfApplication("C100") .respondents(listOfRespondents) .build(); - Map objectMap = new HashMap<>(); - CallbackRequest callbackRequest = CallbackRequest.builder() - .caseDetailsBefore(CaseDetails - .builder() - .state(State.CASE_ISSUED.getValue()) - .data(objectMap) - .build()) - .build(); - Map stringObjectMap = callbackRequest.getCaseDetailsBefore().getData(); respondentBefore = respondentBefore.toBuilder() .email("test1") .build(); @@ -1725,7 +1640,7 @@ void checkIfDetailsChangedC100EmailOnly() { caseDataBefore, wrappedRespondent ); - assertEquals(true, bool); + assertTrue(bool); } @Test @@ -1743,15 +1658,6 @@ void checkIfDetailsChangedC100AddressOnly() { .caseTypeOfApplication("C100") .respondents(listOfRespondents) .build(); - Map objectMap = new HashMap<>(); - CallbackRequest callbackRequest = CallbackRequest.builder() - .caseDetailsBefore(CaseDetails - .builder() - .state(State.CASE_ISSUED.getValue()) - .data(objectMap) - .build()) - .build(); - Map stringObjectMap = callbackRequest.getCaseDetailsBefore().getData(); respondentBefore = respondentBefore.toBuilder() .address(Address.builder() .addressLine1("test1") @@ -1762,7 +1668,7 @@ void checkIfDetailsChangedC100AddressOnly() { caseDataBefore, wrappedRespondent ); - assertEquals(true, bool); + assertTrue(bool); } @Test @@ -1778,15 +1684,6 @@ void checkIfDetailsChangedC100PhoneOnly() { .caseTypeOfApplication("C100") .respondents(listOfRespondents) .build(); - Map objectMap = new HashMap<>(); - CallbackRequest callbackRequest = CallbackRequest.builder() - .caseDetailsBefore(CaseDetails - .builder() - .state(State.CASE_ISSUED.getValue()) - .data(objectMap) - .build()) - .build(); - Map stringObjectMap = callbackRequest.getCaseDetailsBefore().getData(); respondentBefore = respondentBefore.toBuilder() .phoneNumber("012345") .build(); @@ -1795,7 +1692,7 @@ void checkIfDetailsChangedC100PhoneOnly() { caseDataBefore, wrappedRespondent ); - assertEquals(true, bool); + assertTrue(bool); } @Test @@ -1811,20 +1708,11 @@ void checkIfDetailsChangedC100NoChange() { .caseTypeOfApplication("C100") .respondents(listOfRespondents) .build(); - Map objectMap = new HashMap<>(); - CallbackRequest callbackRequest = CallbackRequest.builder() - .caseDetailsBefore(CaseDetails - .builder() - .state(State.CASE_ISSUED.getValue()) - .data(objectMap) - .build()) - .build(); - Map stringObjectMap = callbackRequest.getCaseDetailsBefore().getData(); boolean bool = updatePartyDetailsService.checkIfConfidentialityDetailsChangedRespondent( caseDataBefore, wrappedRespondentBefore ); - assertEquals(false, bool); + assertFalse(bool); } @Test @@ -1852,10 +1740,8 @@ void testUpdateApplicantRespondentAndChildDataCaseTypeEmpty() { assertNotNull(updatedCaseData); } - @Test void testAmendOtherPeopleInTheCase() { - CaseData caseData = CaseData.builder().build(); Map objectMap = new HashMap<>(); objectMap.put("caseTypeOfApplication", "C100"); CallbackRequest callbackRequest = CallbackRequest.builder().caseDetails(CaseDetails.builder() @@ -1927,8 +1813,6 @@ void testGenerateC8DocsAllRespondents() { @Test void testSetApplicantDefaultApplicant() { - - PartyDetails respondent1 = PartyDetails.builder() .firstName("respondent1") .lastName("lastname1") @@ -1959,7 +1843,6 @@ void testSetApplicantDefaultApplicant() { assertNotNull(updatedCaseData.get("applicants")); } - @Test void testSetApplicantDefaultApplicant_scenario2() { PartyDetails respondent1 = PartyDetails.builder() @@ -1994,8 +1877,6 @@ void testSetApplicantDefaultApplicant_scenario2() { @Test void testSetRespondentsDefaultApplicant() { - - PartyDetails respondent1 = PartyDetails.builder() .firstName("respondent1") .lastName("lastname1") @@ -2106,7 +1987,7 @@ void testSetDefaultEmptyChildDetails_whenNoChildDetailsPresent() { Map updatedCaseData = updatePartyDetailsService.setDefaultEmptyChildDetails(caseData); List> updatedChildDetails = (List>) updatedCaseData.get("children"); assertEquals(1, updatedChildDetails.size()); - assertEquals(Child.builder().build(), updatedChildDetails.get(0).getValue()); + assertEquals(Child.builder().build(), updatedChildDetails.getFirst().getValue()); } @Test @@ -2194,7 +2075,6 @@ void testSetDefaultEmptyChildDetails_whenNoRevisedChildDetailsPresent() { assertEquals(1, updatedChildDetails.size()); } - @Test void testUpdateOtherPeopleInTheCaseConfidentialityData() { PartyDetails applicant = PartyDetails.builder().firstName("test").build(); @@ -2282,7 +2162,6 @@ void testUpdateOtherPeopleInTheCaseConfidentialityData() { Map updatedCaseData = updatePartyDetailsService.updateOtherPeopleInTheCaseConfidentialityData( callbackRequest); assertNotNull(updatedCaseData); - } @Test @@ -2507,7 +2386,6 @@ void shouldReturnEmptyValidateUpdatePartyDetailsIfBarristerPresentAndApplicantIs .respondents(List.of(respondent)) .build(); - Map caseDataMapBefore = new HashMap<>(); Map caseDataMap = new HashMap<>(); caseDataMapBefore.put("before", true); @@ -2538,7 +2416,6 @@ void shouldReturnEmptyValidateUpdatePartyDetailsIfBarristerPresentAndApplicantIs List validationErrorList = updatePartyDetailsService.validateUpdatePartyDetails(callbackRequest); assertTrue(validationErrorList.isEmpty()); - } @Test @@ -2560,7 +2437,6 @@ void shouldReturnEmptyValidateUpdatePartyDetailsIfNoBarristerAndApplicantIsRemov .respondents(List.of(respondent)) .build(); - Map caseDataMapBefore = new HashMap<>(); Map caseDataMap = new HashMap<>(); caseDataMapBefore.put("before", true); @@ -2591,7 +2467,6 @@ void shouldReturnEmptyValidateUpdatePartyDetailsIfNoBarristerAndApplicantIsRemov List validationErrorList = updatePartyDetailsService.validateUpdatePartyDetails(callbackRequest); assertTrue(validationErrorList.isEmpty()); - } @Test @@ -2643,9 +2518,7 @@ void shouldReturnValidateUpdatePartyDetailsIfBarristerPresentAndApplicantIsRemov List validationErrorList = updatePartyDetailsService.validateUpdatePartyDetails(callbackRequest); - assertTrue(!validationErrorList.isEmpty()); assertTrue(validationErrorList.getFirst().contains("Barrister is associated with the party")); - } @Test @@ -2737,9 +2610,7 @@ void shouldReturnValidationErrorWhenRespondantsChangeAndBarristerPresentForC100( List validationErrorList = updatePartyDetailsService.validateUpdatePartyDetails(callbackRequest); - assertTrue(!validationErrorList.isEmpty()); assertTrue(validationErrorList.getFirst().contains("Barrister is associated with the party")); - } @Test @@ -2789,12 +2660,9 @@ void shouldReturnValidateUpdatePartyDetailsIfBarristerPresentAndRespondentIsRemo return null; }); - List validationErrorList = updatePartyDetailsService.validateUpdatePartyDetails(callbackRequest); - assertTrue(!validationErrorList.isEmpty()); assertTrue(validationErrorList.getFirst().contains("Barrister is associated with the party")); - } @Test @@ -2826,7 +2694,6 @@ void shouldReturnEmptyValidateUpdatePartyDetailsForFL401() { List validationErrorList = updatePartyDetailsService.validateUpdatePartyDetails(callbackRequest); assertTrue(validationErrorList.isEmpty()); - } private Element getPartyDetails(String partyName, boolean hasBarrister) { @@ -2842,5 +2709,4 @@ private Element getPartyDetails(UUID id, String partyName, boolean .firstName(partyName).build()) .build(); } - }