-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSCSCI-1493 #4288
Closed
Closed
SSCSCI-1493 #4288
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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 |
---|---|---|
|
@@ -57,14 +57,14 @@ public void setup() { | |
placeholders = new HashMap<>(); | ||
|
||
given(pdfDocumentConfig.getHmctsImgKey()).willReturn("hmctsKey"); | ||
given(exelaAddressConfig.getAddressLine1()).willReturn("Line 1"); | ||
given(exelaAddressConfig.getAddressLine2()).willReturn("Line 2"); | ||
given(exelaAddressConfig.getAddressLine3()).willReturn("Line 3"); | ||
given(exelaAddressConfig.getAddressPostcode()).willReturn("Postcode"); | ||
} | ||
|
||
@Test | ||
public void givenACase_thenPopulateThePlaceholders() { | ||
given(exelaAddressConfig.getAddressLine1()).willReturn("Line 1"); | ||
given(exelaAddressConfig.getAddressLine2()).willReturn("Line 2"); | ||
given(exelaAddressConfig.getAddressLine3()).willReturn("Line 3"); | ||
given(exelaAddressConfig.getAddressPostcode()).willReturn("Postcode"); | ||
Address address = Address.builder() | ||
.line1("Unit 2") | ||
.line2("156 The Road") | ||
|
@@ -100,6 +100,10 @@ public void givenACase_thenPopulateThePlaceholders() { | |
|
||
@Test | ||
public void givenACase_thenPopulateThePlaceholdersWithBenefitTypeEmpty() { | ||
given(exelaAddressConfig.getAddressLine1()).willReturn("Line 1"); | ||
given(exelaAddressConfig.getAddressLine2()).willReturn("Line 2"); | ||
given(exelaAddressConfig.getAddressLine3()).willReturn("Line 3"); | ||
given(exelaAddressConfig.getAddressPostcode()).willReturn("Postcode"); | ||
Address address = Address.builder() | ||
.line1("Unit 2") | ||
.line2("156 The Road") | ||
|
@@ -115,6 +119,10 @@ public void givenACase_thenPopulateThePlaceholdersWithBenefitTypeEmpty() { | |
|
||
@Test | ||
public void givenACase_thenPopulateThePlaceholdersWithBenefitTypeDescriptionEmpty() { | ||
given(exelaAddressConfig.getAddressLine1()).willReturn("Line 1"); | ||
given(exelaAddressConfig.getAddressLine2()).willReturn("Line 2"); | ||
given(exelaAddressConfig.getAddressLine3()).willReturn("Line 3"); | ||
given(exelaAddressConfig.getAddressPostcode()).willReturn("Postcode"); | ||
Address address = Address.builder() | ||
.line1("Unit 2") | ||
.line2("156 The Road") | ||
|
@@ -153,6 +161,10 @@ public void givenACase_thenPopulateThePlaceholdersWithBenefitTypeDescriptionEmpt | |
|
||
@Test | ||
public void givenARecipientAddressWith4Lines_thenPopulateThePlaceholders() { | ||
given(exelaAddressConfig.getAddressLine1()).willReturn("Line 1"); | ||
given(exelaAddressConfig.getAddressLine2()).willReturn("Line 2"); | ||
given(exelaAddressConfig.getAddressLine3()).willReturn("Line 3"); | ||
given(exelaAddressConfig.getAddressPostcode()).willReturn("Postcode"); | ||
Address address = Address.builder() | ||
.line1("Unit 2") | ||
.town("Lechworth") | ||
|
@@ -169,6 +181,10 @@ public void givenARecipientAddressWith4Lines_thenPopulateThePlaceholders() { | |
|
||
@Test | ||
public void givenAnAppellantWithALongNameAndAddressExceeding45Characters_thenGenerateThePlaceholdersWithTruncatedName() { | ||
given(exelaAddressConfig.getAddressLine1()).willReturn("Line 1"); | ||
given(exelaAddressConfig.getAddressLine2()).willReturn("Line 2"); | ||
given(exelaAddressConfig.getAddressLine3()).willReturn("Line 3"); | ||
given(exelaAddressConfig.getAddressPostcode()).willReturn("Postcode"); | ||
Address address = Address.builder() | ||
.line1("MyFirstVeryVeryLongAddressLineWithLotsOfCharacters") | ||
.line2("MySecondVeryVeryLongAddressLineWithLotsOfCharacters") | ||
|
@@ -188,6 +204,10 @@ public void givenAnAppellantWithALongNameAndAddressExceeding45Characters_thenGen | |
|
||
@Test | ||
public void givenARecipientAddressWith3Lines_thenPopulateThePlaceholders() { | ||
given(exelaAddressConfig.getAddressLine1()).willReturn("Line 1"); | ||
given(exelaAddressConfig.getAddressLine2()).willReturn("Line 2"); | ||
given(exelaAddressConfig.getAddressLine3()).willReturn("Line 3"); | ||
given(exelaAddressConfig.getAddressPostcode()).willReturn("Postcode"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you could put these 4 mocks in a method to reduce repetition |
||
Address address = Address.builder() | ||
.line1("Unit 2") | ||
.county("Bedford") | ||
|
@@ -202,6 +222,10 @@ public void givenARecipientAddressWith3Lines_thenPopulateThePlaceholders() { | |
|
||
@Test | ||
public void givenALanguagePreferenceIsWelsh_ThenPickWelshLogo() { | ||
given(exelaAddressConfig.getAddressLine1()).willReturn("Line 1"); | ||
given(exelaAddressConfig.getAddressLine2()).willReturn("Line 2"); | ||
given(exelaAddressConfig.getAddressLine3()).willReturn("Line 3"); | ||
given(exelaAddressConfig.getAddressPostcode()).willReturn("Postcode"); | ||
caseData.setLanguagePreferenceWelsh("Yes"); | ||
given(pdfDocumentConfig.getHmctsWelshImgKey()).willReturn("hmctsWelshImgKey"); | ||
given(pdfDocumentConfig.getHmctsWelshImgVal()).willReturn("welshhmcts.png"); | ||
|
@@ -220,6 +244,10 @@ public void givenALanguagePreferenceIsWelsh_ThenPickWelshLogo() { | |
|
||
@Test | ||
public void givenAChildSupportCase_thenShouldHideNino() { | ||
given(exelaAddressConfig.getAddressLine1()).willReturn("Line 1"); | ||
given(exelaAddressConfig.getAddressLine2()).willReturn("Line 2"); | ||
given(exelaAddressConfig.getAddressLine3()).willReturn("Line 3"); | ||
given(exelaAddressConfig.getAddressPostcode()).willReturn("Postcode"); | ||
caseData.setLanguagePreferenceWelsh("Yes"); | ||
caseData.getAppeal().getBenefitType().setCode(CHILD_SUPPORT.getShortName()); | ||
caseData.getAppeal().getBenefitType().setDescription(CHILD_SUPPORT.getDescription()); | ||
|
@@ -238,6 +266,10 @@ public void givenAChildSupportCase_thenShouldHideNino() { | |
|
||
@Test | ||
public void givenAnIbcaCase_thenPopulateThePlaceholders() { | ||
given(exelaAddressConfig.getIbcAddressLine1()).willReturn("IBC line 1"); | ||
given(exelaAddressConfig.getIbcAddressLine2()).willReturn("IBC line 2"); | ||
given(exelaAddressConfig.getIbcAddressPostcode()).willReturn("IBC postcode"); | ||
given(exelaAddressConfig.getAddressLine3()).willReturn("Line 3"); | ||
caseData.setBenefitCode(IBCA_BENEFIT_CODE); | ||
caseData.getAppeal().setBenefitType(BenefitType.builder() | ||
.code("infectedBloodCompensation") | ||
|
@@ -267,9 +299,10 @@ public void givenAnIbcaCase_thenPopulateThePlaceholders() { | |
assertEquals("INFECTED BLOOD COMPENSATION", placeholders.get(BENEFIT_TYPE_LITERAL)); | ||
assertEquals("123456", placeholders.get(CASE_ID_LITERAL)); | ||
assertEquals(IBCA_URL, placeholders.get(SSCS_URL_LITERAL)); | ||
assertEquals("Line 1", placeholders.get(EXELA_ADDRESS_LINE1_LITERAL)); | ||
assertEquals("Line 2", placeholders.get(EXELA_ADDRESS_LINE2_LITERAL)); | ||
assertEquals("IBC line 1", placeholders.get(EXELA_ADDRESS_LINE1_LITERAL)); | ||
assertEquals("IBC line 2", placeholders.get(EXELA_ADDRESS_LINE2_LITERAL)); | ||
assertEquals("Line 3", placeholders.get(EXELA_ADDRESS_LINE3_LITERAL)); | ||
assertEquals("IBC postcode", placeholders.get(EXELA_ADDRESS_POSTCODE_LITERAL)); | ||
assertEquals("Unit 2", placeholders.get(RECIPIENT_ADDRESS_LINE_1_LITERAL)); | ||
assertEquals("156 The Road", placeholders.get(RECIPIENT_ADDRESS_LINE_2_LITERAL)); | ||
assertEquals("Lechworth", placeholders.get(RECIPIENT_ADDRESS_LINE_3_LITERAL)); | ||
|
@@ -279,4 +312,48 @@ public void givenAnIbcaCase_thenPopulateThePlaceholders() { | |
assertEquals("IBCA123456", placeholders.get(NINO_LITERAL)); | ||
assertEquals("IBCA Reference", placeholders.get(LABEL)); | ||
} | ||
|
||
@Test | ||
public void givenAScottishCase_thenPopulateThePlaceholders() { | ||
service = new PlaceholderService(pdfDocumentConfig, exelaAddressConfig, true); | ||
given(exelaAddressConfig.getScottishAddressLine2()).willReturn("Scottish line 2"); | ||
given(exelaAddressConfig.getScottishPostcode()).willReturn("Scottish postcode"); | ||
given(exelaAddressConfig.getAddressLine1()).willReturn("Line 1"); | ||
given(exelaAddressConfig.getAddressLine3()).willReturn("Line 3"); | ||
caseData.setIsScottishCase("Yes"); | ||
|
||
Address address = Address.builder() | ||
.line1("Unit 2") | ||
.line2("156 The Road") | ||
.town("Lechworth") | ||
.county("Bedford") | ||
.postcode("L2 5UZ").build(); | ||
|
||
service.build(caseData, placeholders, address, now); | ||
|
||
assertEquals("HM Courts & Tribunals Service", placeholders.get(REGIONAL_OFFICE_ADDRESS_LINE1_LITERAL)); | ||
assertEquals("Social Security & Child Support Appeals", placeholders.get(REGIONAL_OFFICE_ADDRESS_LINE2_LITERAL)); | ||
assertEquals("Prudential Buildings", placeholders.get(REGIONAL_OFFICE_ADDRESS_LINE3_LITERAL)); | ||
assertEquals("36 Dale Street", placeholders.get(REGIONAL_OFFICE_ADDRESS_LINE4_LITERAL)); | ||
assertEquals("LIVERPOOL", placeholders.get(REGIONAL_OFFICE_COUNTY_LITERAL)); | ||
assertEquals("L2 5UZ", placeholders.get(REGIONAL_OFFICE_POSTCODE_LITERAL)); | ||
assertEquals(now, placeholders.get(GENERATED_DATE_LITERAL)); | ||
assertEquals(now, placeholders.get(CASE_CREATED_DATE_LITERAL)); | ||
assertEquals("Mr T Tibbs", placeholders.get(APPELLANT_FULL_NAME_LITERAL)); | ||
assertEquals("PERSONAL INDEPENDENCE PAYMENT", placeholders.get(BENEFIT_TYPE_LITERAL)); | ||
assertEquals("123456", placeholders.get(CASE_ID_LITERAL)); | ||
assertEquals("JT0123456B", placeholders.get(NINO_LITERAL)); | ||
assertEquals("https://www.gov.uk/appeal-benefit-decision", placeholders.get(SSCS_URL_LITERAL)); | ||
assertEquals("Line 1", placeholders.get(EXELA_ADDRESS_LINE1_LITERAL)); | ||
assertEquals("Scottish line 2", placeholders.get(EXELA_ADDRESS_LINE2_LITERAL)); | ||
assertEquals("Scottish postcode", placeholders.get(EXELA_ADDRESS_POSTCODE_LITERAL)); | ||
assertEquals("Line 3", placeholders.get(EXELA_ADDRESS_LINE3_LITERAL)); | ||
assertEquals("Unit 2", placeholders.get(RECIPIENT_ADDRESS_LINE_1_LITERAL)); | ||
assertEquals("156 The Road", placeholders.get(RECIPIENT_ADDRESS_LINE_2_LITERAL)); | ||
assertEquals("Lechworth", placeholders.get(RECIPIENT_ADDRESS_LINE_3_LITERAL)); | ||
assertEquals("Bedford", placeholders.get(RECIPIENT_ADDRESS_LINE_4_LITERAL)); | ||
assertEquals("L2 5UZ", placeholders.get(RECIPIENT_ADDRESS_LINE_5_LITERAL)); | ||
assertEquals("SC123/12/1234", placeholders.get(SC_NUMBER_LITERAL)); | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use the same properties since it's the same value?