Skip to content

Commit 1a4ed08

Browse files
authored
FACT-1395 remove assertEnvelopeContainsDocsOfAllowedTypesForService DO NOT MERGE (#3269)
* removed assertEnvelopeContainsDocsOfAllowedTypesForService and relevant tests * remove integration test * attempt to put pact fix * wrong version * trying move finalizedby to runAndPublishConsumerPactTests * undo pact attempt stuff * removed unused bit of code * attempt to update pact * updated java version * pact back to old one
1 parent 5d390d9 commit 1a4ed08

File tree

4 files changed

+0
-97
lines changed

4 files changed

+0
-97
lines changed

src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/tasks/BlobProcessorTaskTestForFailedStatus.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -135,21 +135,6 @@ public void should_record_validation_failure_when_ocr_data_is_missing_for_form_s
135135
errorWasSent(SAMPLE_ZIP_FILE_NAME, ErrorCode.ERR_METAFILE_INVALID);
136136
}
137137

138-
@Test
139-
public void should_record_validation_failure_when_document_type_is_not_supported_for_service() throws Exception {
140-
// given
141-
uploadToBlobStorage(SAMPLE_ZIP_FILE_NAME, zipDir("zipcontents/invalid-document-type-for-service"));
142-
143-
// when
144-
processor.processBlobs();
145-
146-
// then
147-
envelopeWasNotCreated();
148-
eventsWereCreated(ZIPFILE_PROCESSING_STARTED, FILE_VALIDATION_FAILURE);
149-
fileWasDeleted(SAMPLE_ZIP_FILE_NAME);
150-
errorWasSent(SAMPLE_ZIP_FILE_NAME, ErrorCode.ERR_METAFILE_INVALID);
151-
}
152-
153138
@Test
154139
public void should_record_validation_failure_when_document_type_is_not_supported() throws Exception {
155140
// given

src/main/java/uk/gov/hmcts/reform/bulkscanprocessor/services/EnvelopeHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ public void handleEnvelope(
9292
envelopeValidator.assertPaymentsEnabledForContainerIfPaymentsArePresent(
9393
inputEnvelope, paymentsEnabled, containerMappings.getMappings()
9494
);
95-
envelopeValidator.assertEnvelopeContainsDocsOfAllowedTypesForService(inputEnvelope);
9695
envelopeValidator.assertEnvelopeContainsDocsOfAllowedTypesOnly(inputEnvelope);
9796

9897
envelopeProcessor.assertDidNotFailToUploadBefore(inputEnvelope.zipFileName, containerName);

src/main/java/uk/gov/hmcts/reform/bulkscanprocessor/validation/EnvelopeValidator.java

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
import static java.util.Arrays.asList;
2929
import static java.util.Collections.emptyList;
30-
import static java.util.Collections.singletonList;
3130
import static java.util.Objects.isNull;
3231
import static java.util.stream.Collectors.counting;
3332
import static java.util.stream.Collectors.groupingBy;
@@ -49,16 +48,6 @@ public final class EnvelopeValidator {
4948
"SSCS", InputDocumentType.SSCS1
5049
);
5150

52-
private static final String probateJurisdiction = "PROBATE";
53-
private static final Map<InputDocumentType, List<String>> jurisdictionSpecificDocumentTypes =
54-
Map.of(InputDocumentType.WILL, singletonList(probateJurisdiction),
55-
InputDocumentType.IHT, singletonList(probateJurisdiction),
56-
InputDocumentType.FORENSIC_SHEETS, singletonList(probateJurisdiction),
57-
InputDocumentType.SUPPORTING_DOCUMENTS, List.of(probateJurisdiction, "BULKSCAN"),
58-
InputDocumentType.PPS_LEGAL_STATEMENT, singletonList(probateJurisdiction),
59-
InputDocumentType.PPS_LEGAL_STATEMENT_WITHOUT_APOSTROPHE, singletonList(probateJurisdiction)
60-
);
61-
6251
private static final Map<Classification, List<InputDocumentType>> disallowedDocumentTypes =
6352
Map.of(
6453
Classification.EXCEPTION, emptyList(),
@@ -67,34 +56,6 @@ Classification.SUPPLEMENTARY_EVIDENCE, asList(InputDocumentType.FORM, InputDocum
6756
Classification.SUPPLEMENTARY_EVIDENCE_WITH_OCR, emptyList()
6857
);
6958

70-
/**
71-
* Assert envelope contains only scannable items of types that are allowed for the envelope's jurisdiction.
72-
*
73-
* @param envelope to assert against
74-
* @throws DisallowedDocumentTypesException if envelope contains scannable items of types that are not allowed
75-
*/
76-
public void assertEnvelopeContainsDocsOfAllowedTypesForService(InputEnvelope envelope) {
77-
List<String> disallowedDocTypesFound =
78-
envelope
79-
.scannableItems
80-
.stream()
81-
.filter(item -> jurisdictionSpecificDocumentTypes.containsKey(item.documentType)
82-
&& !jurisdictionSpecificDocumentTypes.get(item.documentType).contains(envelope.jurisdiction))
83-
.map(item -> item.documentType.toString())
84-
.collect(toList());
85-
86-
if (!disallowedDocTypesFound.isEmpty()) {
87-
88-
String errorMessage = String.format(
89-
"Envelope contains scannable item(s) of types that are not allowed for jurisdiction '%s': [%s]",
90-
envelope.jurisdiction,
91-
StringUtils.join(disallowedDocTypesFound, ", ")
92-
);
93-
94-
throw new DisallowedDocumentTypesException(errorMessage);
95-
}
96-
}
97-
9859
/**
9960
* Assert envelope contains only scannable items of types that are allowed for the envelope's classification.
10061
*

src/test/java/uk/gov/hmcts/reform/bulkscanprocessor/validation/EnvelopeValidatorTest.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -678,48 +678,6 @@ void assertServiceEnabled_passes_if_pobox_is_correct_multiple_poboxes() {
678678
);
679679
}
680680

681-
@Test
682-
void assertEnvelopeContainsDocsOfAllowedTypesForService_should_pass() {
683-
// given
684-
InputEnvelope envelope = InputEnvelopeCreator.inputEnvelope(
685-
"BULKSCAN",
686-
"POBOX",
687-
Classification.EXCEPTION,
688-
List.of(
689-
scannableItem("file1", InputDocumentType.CHERISHED),
690-
scannableItem("file2", InputDocumentType.SUPPORTING_DOCUMENTS)
691-
)
692-
);
693-
694-
// when
695-
// then
696-
assertDoesNotThrow(() -> envelopeValidator.assertEnvelopeContainsDocsOfAllowedTypesForService(envelope));
697-
}
698-
699-
@Test
700-
void assertEnvelopeContainsDocsOfAllowedTypesForService_should_fail() {
701-
// given
702-
InputEnvelope envelope = InputEnvelopeCreator.inputEnvelope(
703-
"BULKSCAN",
704-
"POBOX",
705-
Classification.EXCEPTION,
706-
List.of(
707-
scannableItem("file1", InputDocumentType.CHERISHED),
708-
scannableItem("file2", InputDocumentType.SUPPORTING_DOCUMENTS),
709-
scannableItem("file3", InputDocumentType.IHT),
710-
scannableItem("file4", InputDocumentType.OTHER)
711-
)
712-
);
713-
714-
// when
715-
// then
716-
assertThatThrownBy(() -> envelopeValidator.assertEnvelopeContainsDocsOfAllowedTypesForService(envelope))
717-
.isInstanceOf(DisallowedDocumentTypesException.class)
718-
.hasMessage(
719-
"Envelope contains scannable item(s) of types that are not allowed for jurisdiction 'BULKSCAN': [IHT]"
720-
);
721-
}
722-
723681
@Test
724682
void assertServiceEnabled_throws_if_pobox_is_incorrect() {
725683
// given

0 commit comments

Comments
 (0)