-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DFPL-2639: Move living situation (+ details) to the confidential tab (#…
…5796) Co-authored-by: prabhamuthu15 <[email protected]>
- Loading branch information
1 parent
8810d75
commit 0da2a55
Showing
2 changed files
with
61 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,6 +191,22 @@ void shouldRemoveConfidentialDetailsFromCaseDetailsWhenNoConfidentialDetails() { | |
assertThat(caseDetails.getData()).isEmpty(); | ||
} | ||
|
||
@Test | ||
void shouldNotOverrideOldDataIfLivingDetailsNotHiddenYet() { | ||
Element<Child> originalChild = childWithRemovedConfidentialFieldsWithLivingSituation(ID); | ||
Element<Child> confDetails = childWithConfidentialFieldsAndShowAddressButNoLivingSituation(ID); | ||
CaseData caseData = CaseData.builder() | ||
.children1(List.of(originalChild)) | ||
.confidentialChildren(List.of(confDetails)) | ||
.build(); | ||
|
||
List<Element<Child>> updatedChildren = service.prepareCollection(caseData.getAllChildren(), | ||
caseData.getConfidentialChildren(), Child.expandCollection()); | ||
|
||
assertThat(updatedChildren.get(0).getValue().getParty()) | ||
.extracting("livingSituation", "livingSituationDetails") | ||
.containsExactly("Living with parents", "Details here"); | ||
} | ||
|
||
private ChildParty.ChildPartyBuilder baseChildBuilder(String detailsHidden) { | ||
return ChildParty.builder() | ||
|
@@ -205,12 +221,34 @@ private Element<Child> childWithRemovedConfidentialFields(UUID id) { | |
.build()); | ||
} | ||
|
||
private Element<Child> childWithRemovedConfidentialFieldsWithLivingSituation(UUID id) { | ||
// Prior to DFPL-2639, living situation + details were not confidential | ||
return element(id, Child.builder() | ||
.party(baseChildBuilder(CONFIDENTIAL) | ||
.livingSituation("Living with parents") | ||
.livingSituationDetails("Details here") | ||
.build()) | ||
.build()); | ||
} | ||
|
||
private Element<Child> childWithConfidentialFieldsAndShowAddressButNoLivingSituation(UUID id) { | ||
return element(id, Child.builder() | ||
.party(baseChildBuilder(NO_VALUE) | ||
.email(EmailAddress.builder().email("[email protected]").build()) | ||
.address(Address.builder().addressLine1("Address Line 1").build()) | ||
.telephoneNumber(Telephone.builder().telephoneNumber("01227 831393").build()) | ||
.showAddressInConfidentialTab("Yes") | ||
.build()) | ||
.build()); | ||
} | ||
|
||
private Element<Child> childWithConfidentialFields(UUID id, String detailsHidden) { | ||
return element(id, Child.builder() | ||
.party(baseChildBuilder(detailsHidden) | ||
.email(EmailAddress.builder().email("[email protected]").build()) | ||
.address(Address.builder().addressLine1("Address Line 1").build()) | ||
.telephoneNumber(Telephone.builder().telephoneNumber("01227 831393").build()) | ||
.livingSituation("Living in a refuge") | ||
.build()) | ||
.build()); | ||
} | ||
|
@@ -222,6 +260,7 @@ private Element<Child> childWithConfidentialFieldsAndShowAddress() { | |
.address(Address.builder().addressLine1("Address Line 1").build()) | ||
.telephoneNumber(Telephone.builder().telephoneNumber("01227 831393").build()) | ||
.showAddressInConfidentialTab("Yes") | ||
.livingSituation("Living in a refuge") | ||
.build()) | ||
.build()); | ||
} | ||
|