Skip to content
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

DTSPB-4293 Added Ad Colligenda Bona in Data extracts #2976

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions src/main/java/uk/gov/hmcts/probate/model/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
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;

public enum DataExtractGrantType {
gop(EXTRACT_PROBATE),
intestacy(EXTRACT_ADMINISTRATION),
admonWill(EXTRACT_ADMON_WILL);
admonWill(EXTRACT_ADMON_WILL),
adColligendaBona(EXTRACT_AD_COLLIGENDA_BONA);
IswaryaPepakayala marked this conversation as resolved.
Show resolved Hide resolved

private String caseTypeItem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> fileData;

public File createIronMountainFile(List<ReturnedCaseDetails> ccdCases, String fileName) {
log.info("Creating IronMountain file=" + fileName);
fileData = new ImmutableList.Builder<>();
ImmutableList.Builder<String> 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<String> fileData) {
try {
final List<String> deceasedAddress = addressManager(data.getDeceasedAddress());
final List<String> applicantAddress = addressManager(data.getApplicationType().equals(ApplicationType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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~
Original file line number Diff line number Diff line change
@@ -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|
Loading