diff --git a/src/main/java/uk/gov/hmcts/probate/model/Constants.java b/src/main/java/uk/gov/hmcts/probate/model/Constants.java index 728bf0c52b..abcb3972d2 100644 --- a/src/main/java/uk/gov/hmcts/probate/model/Constants.java +++ b/src/main/java/uk/gov/hmcts/probate/model/Constants.java @@ -21,6 +21,8 @@ public final class Constants { public static final String EXTRACT_PROBATE = "PROBATE"; public static final String EXTRACT_ADMINISTRATION = "ADMINISTRATION"; public static final String EXTRACT_ADMON_WILL = "ADMON/WILL"; + + public static final String EXTRACT_AD_COLLIGENDA_BONA = "AdCol"; public static final String PRINCIPAL_REGISTRY = "Principal Registry"; public static final String DOC_SUBTYPE_WILL = "will"; public static final String DOC_TYPE_COVERSHEET = "coversheet"; diff --git a/src/main/java/uk/gov/hmcts/probate/model/DataExtractGrantType.java b/src/main/java/uk/gov/hmcts/probate/model/DataExtractGrantType.java index a37f81f786..e0057efd90 100644 --- a/src/main/java/uk/gov/hmcts/probate/model/DataExtractGrantType.java +++ b/src/main/java/uk/gov/hmcts/probate/model/DataExtractGrantType.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.probate.model; +import static uk.gov.hmcts.probate.model.Constants.EXTRACT_AD_COLLIGENDA_BONA; import static uk.gov.hmcts.probate.model.Constants.EXTRACT_ADMINISTRATION; import static uk.gov.hmcts.probate.model.Constants.EXTRACT_ADMON_WILL; import static uk.gov.hmcts.probate.model.Constants.EXTRACT_PROBATE; @@ -7,7 +8,8 @@ public enum DataExtractGrantType { gop(EXTRACT_PROBATE), intestacy(EXTRACT_ADMINISTRATION), - admonWill(EXTRACT_ADMON_WILL); + admonWill(EXTRACT_ADMON_WILL), + adColligendaBona(EXTRACT_AD_COLLIGENDA_BONA); private String caseTypeItem; diff --git a/src/main/java/uk/gov/hmcts/probate/service/filebuilder/IronMountainFileService.java b/src/main/java/uk/gov/hmcts/probate/service/filebuilder/IronMountainFileService.java index 6032d0ead7..5e77a362d1 100644 --- a/src/main/java/uk/gov/hmcts/probate/service/filebuilder/IronMountainFileService.java +++ b/src/main/java/uk/gov/hmcts/probate/service/filebuilder/IronMountainFileService.java @@ -23,20 +23,19 @@ public class IronMountainFileService extends BaseFileService { private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd-MMM-yyyy"); private static final String DELIMITER = "|"; private final TextFileBuilderService textFileBuilderService; - private ImmutableList.Builder fileData; public File createIronMountainFile(List ccdCases, String fileName) { log.info("Creating IronMountain file=" + fileName); - fileData = new ImmutableList.Builder<>(); + ImmutableList.Builder fileData = new ImmutableList.Builder<>(); fileData.add("\n"); for (ReturnedCaseDetails ccdCase : ccdCases) { - prepareData(ccdCase.getId(), ccdCase.getData()); + prepareData(ccdCase.getId(), ccdCase.getData(), fileData); } log.info("Created IronMountain file=" + fileName); return textFileBuilderService.createFile(fileData.build(), DELIMITER, fileName); } - private void prepareData(Long id, CaseData data) { + private void prepareData(Long id, CaseData data, ImmutableList.Builder fileData) { try { final List deceasedAddress = addressManager(data.getDeceasedAddress()); final List applicantAddress = addressManager(data.getApplicationType().equals(ApplicationType diff --git a/src/test/java/uk/gov/hmcts/probate/service/filebuilder/HmrcFileServiceTest.java b/src/test/java/uk/gov/hmcts/probate/service/filebuilder/HmrcFileServiceTest.java index 0b72d40496..edd91b9068 100644 --- a/src/test/java/uk/gov/hmcts/probate/service/filebuilder/HmrcFileServiceTest.java +++ b/src/test/java/uk/gov/hmcts/probate/service/filebuilder/HmrcFileServiceTest.java @@ -319,6 +319,16 @@ void testHmrcFileBuiltForSolicitor() throws IOException { is(FileUtils.getStringFromFile("expectedGeneratedFiles/hmrcSolicitor.txt"))); } + @Test + void testAdColligendaBonaCaseType() throws IOException { + caseDataSolictor.caseType("adColligendaBona"); + builtData = caseDataSolictor.build(); + createdCase = new ReturnedCaseDetails(builtData, LAST_MODIFIED, 1111222233334444L); + caseList.add(createdCase); + assertThat(createFile(hmrcFileService.createHmrcFile(caseList.build(), FILE_NAME)), + is(FileUtils.getStringFromFile("expectedGeneratedFiles/hmrcAdColligendaBona.txt"))); + } + @Test void testHmrcFileBuiltForPersonal() throws IOException { builtData = caseDataPersonal.build(); diff --git a/src/test/java/uk/gov/hmcts/probate/service/filebuilder/IronMountainFileServiceTest.java b/src/test/java/uk/gov/hmcts/probate/service/filebuilder/IronMountainFileServiceTest.java index 944eac7823..7b4aa1f8ec 100644 --- a/src/test/java/uk/gov/hmcts/probate/service/filebuilder/IronMountainFileServiceTest.java +++ b/src/test/java/uk/gov/hmcts/probate/service/filebuilder/IronMountainFileServiceTest.java @@ -158,6 +158,17 @@ void testSolicitorApplicationTypeDisplaysSolicitorInformation() throws IOExcepti is(FileUtils.getStringFromFile("expectedGeneratedFiles/ironMountainSolicitor.txt"))); } + @Test + void testAdColligendaBonaCaseType() throws IOException { + caseData.caseType("adColligendaBona"); + caseData.applicationType(ApplicationType.SOLICITOR); + builtData = caseData.build(); + createdCase = new ReturnedCaseDetails(builtData, LAST_MODIFIED, 1234567890876L); + caseList.add(createdCase); + assertThat(createFile(ironmountainFileService.createIronMountainFile(caseList.build(), FILE_NAME)), + is(FileUtils.getStringFromFile("expectedGeneratedFiles/ironMountainAdColligendBona.txt"))); + } + @Test void testCarriageReturnInAddressIsReplacedWithSpace() throws IOException { builtData = caseData2.build(); diff --git a/src/test/resources/expectedGeneratedFiles/hmrcAdColligendaBona.txt b/src/test/resources/expectedGeneratedFiles/hmrcAdColligendaBona.txt new file mode 100644 index 0000000000..df512ce374 --- /dev/null +++ b/src/test/resources/expectedGeneratedFiles/hmrcAdColligendaBona.txt @@ -0,0 +1,6 @@ +ENGLAND +T~1111222233334444~Liverpool~MR~PETAR~KRNETA~~~17-AUG-2018~~20-OCT-1940~77~England and Wales~7 Pevensey Avenue~Leicester~~~LE5 6XQ~24-OCT-2018~~ANDJELKA~KOMODROMOS~~37 Otter Lane~Mountsorrel~Loughborough~Leicestershire~LE12 7GL~~Bob~Smith~~123 Fake street~North West East Field~~~AB2 3CD~~~~~~~~~~~~~~~~~~~BRAY & BRAY~Spa Place~36-42 Humberstone Road~Leicester~~LE5 0AE~325000~Y~287000~AdCol~Y~280000~250000~245000~Yes~marriedCivilPartnership~Yes~1~2~ +A~1111222233334444~~PETER PIPER~KRENT~ +A~1111222233334444~~PETE~KRENT~ +A~1111222233334444~~PETRA~~ +Z~1_20190101.dat~4~1~Y~ \ No newline at end of file diff --git a/src/test/resources/expectedGeneratedFiles/ironMountainAdColligendBona.txt b/src/test/resources/expectedGeneratedFiles/ironMountainAdColligendBona.txt new file mode 100644 index 0000000000..824ee4f87f --- /dev/null +++ b/src/test/resources/expectedGeneratedFiles/ironMountainAdColligendBona.txt @@ -0,0 +1,2 @@ + +Mr|Nigel|Deadsoul|01-Jan-2015||01-Jan-1990|25|123 Dead street|The lane|||AB5 6CD|1234567890876|18-Feb-2019||Tim|Timson|321 Fake street||||AB1 2CD||Bob|Smith|123 Fake street|North West East Field|||AB2 3CD|||||||||||||||||SOLICITOR|Solicitors R us|999 solicitor street|||||88|77|AdCol|Oxford|