Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void mapCaseSampleFieldsToCaseUpdateDTO(Case caze, CaseUpdateDTO c
address.setAddressLine3(caze.getAddressLine3());
address.setTownName(caze.getTownName());
address.setPostcode(caze.getPostcode());
address.setRegion(caze.getRegion());
address.setRegion(getLeadingCharacter(caze.getRegion()));
address.setLatitude(caze.getLatitude());
address.setLongitude(caze.getLongitude());
address.setUprn(caze.getUprn());
Expand All @@ -71,4 +71,8 @@ public static void mapCaseSampleFieldsToCaseUpdateDTO(Case caze, CaseUpdateDTO c
caseUpdate.setCaseType(caze.getCaseType());
caseUpdate.setPrintBatch(caze.getPrintBatch());
}

private static String getLeadingCharacter(String value) {
return value == null || value.isEmpty() ? value : value.substring(0, 1);
Comment thread
ravindra-tummuru marked this conversation as resolved.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public void testInvalidCase() throws Exception {
Assertions.assertThat(emittedCase.getAddress().getAddressType())
.isEqualTo(caze.getAddressType());
Assertions.assertThat(emittedCase.getAddress().getPostcode()).isEqualTo(caze.getPostcode());
Assertions.assertThat(emittedCase.getAddress().getRegion()).isEqualTo(caze.getRegion());
Assertions.assertThat(emittedCase.getAddress().getRegion()).isEqualTo("E");
Assertions.assertThat(caze.getRegion()).isEqualTo("EN");

assertThat(eventRepository.findAll().size()).isEqualTo(1);
Event databaseEvent = eventRepository.findAll().get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void testNewCaseLoaded() throws InterruptedException {
newCase.setEstabType("HOUSEHOLD");
newCase.setAddressLine1("123 Fake Street");
newCase.setTownName("Testington");
newCase.setRegion("E");
newCase.setRegion("E12000009");
newCase.setPostcode("NP10 111");
newCase.setAddressType("HH");
newCase.setAddressLevel("U");
Expand Down Expand Up @@ -121,7 +121,7 @@ public void testNewCaseLoaded() throws InterruptedException {
.isEqualTo(newCase.getAddressType());
Assertions.assertThat(emittedCase.getAddress().getPostcode())
.isEqualTo(newCase.getPostcode());
Assertions.assertThat(emittedCase.getAddress().getRegion()).isEqualTo(newCase.getRegion());
Assertions.assertThat(emittedCase.getAddress().getRegion()).isEqualTo("E");

Case actualCase = caseRepository.findById(TEST_CASE_ID).get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ void saveCaseAndEmitCaseUpdatedEvent() {
caze.setCaseRef(1234567890L);
caze.setCollectionExercise(collex);
CaseFieldsHelper.setDummyCaseFields(caze);
caze.setRegion("E12000009");
caze.setInvalid(true);
caze.setRefusalReceived(RefusalType.HARD_REFUSAL);

Expand All @@ -79,7 +80,8 @@ void saveCaseAndEmitCaseUpdatedEvent() {
assertThat(actualCaseUpdate.getAddress().getAddressType()).isEqualTo(caze.getAddressType());
assertThat(actualCaseUpdate.getAddress().getTownName()).isEqualTo(caze.getTownName());
assertThat(actualCaseUpdate.getAddress().getPostcode()).isEqualTo(caze.getPostcode());
assertThat(actualCaseUpdate.getAddress().getRegion()).isEqualTo(caze.getRegion());
assertThat(actualCaseUpdate.getAddress().getRegion()).isEqualTo("E");
assertThat(caze.getRegion()).isEqualTo("E12000009");
}

@Test
Expand Down
Loading