RED-6619 - renamed variables

This commit is contained in:
Thomas Beyer 2023-04-28 16:54:16 +02:00
parent 2e37cd5669
commit aff7074b40

View File

@ -3,7 +3,6 @@ package com.iqser.red.service.redaction.v1.server;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import java.util.Arrays;
import java.util.List; import java.util.List;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
@ -90,7 +89,7 @@ public class RedactionIntegrationV2Test extends AbstractRedactionIntegrationTest
/** /**
* The case in this test: One term, 'Dr. Alan Miller', is found by PII-Rule and is in the PII-dictionary * The case in this test: One term, 'Dr. Alan Miller', is found by PII-Rule and is in the PII-dictionary
* as well as in the PII-false-positive-list - and in the CBI-author dictionary. * as well as in the PII-false-positive-list - and in the CBI-author dictionary.
* It gets redacted, as the PII-finding is false positive and so the CBI-author entry is effective * It gets redacted, as the PII-finding is false positive and so the CBI-author entry is effective,
* independent of the entity-rank * independent of the entity-rank
*/ */
@Test @Test
@ -99,15 +98,18 @@ public class RedactionIntegrationV2Test extends AbstractRedactionIntegrationTest
AnalyzeRequest request = uploadFileToStorage("files/new/simplified2.pdf"); AnalyzeRequest request = uploadFileToStorage("files/new/simplified2.pdf");
String name = "Dr. Alan Miller"; String entryAuthorAndPIIDictionary = "Dr. Alan Miller";
String nameWithCompletionDate = "Dr. Alan Miller COMPLETION DATE:";
dictionary.get(DICTIONARY_AUTHOR).add(name); dictionary.get(DICTIONARY_AUTHOR).add(entryAuthorAndPIIDictionary);
dictionary.put(DICTIONARY_PII, Arrays.asList(name)); dictionary.put(DICTIONARY_PII, List.of(entryAuthorAndPIIDictionary));
falsePositive.put(DICTIONARY_PII, Arrays.asList(nameWithCompletionDate));
String entryPIIFalsePositive = "Dr. Alan Miller COMPLETION DATE:";
falsePositive.put(DICTIONARY_PII, List.of(entryPIIFalsePositive));
reanlysisVersions.put(entryAuthorAndPIIDictionary, 1L);
reanlysisVersions.put(entryPIIFalsePositive, 1L);
reanlysisVersions.put(name, 1L);
reanlysisVersions.put(nameWithCompletionDate, 1L);
when(dictionaryClient.getVersion(TEST_DOSSIER_TEMPLATE_ID)).thenReturn(3L); when(dictionaryClient.getVersion(TEST_DOSSIER_TEMPLATE_ID)).thenReturn(3L);
mockDictionaryCalls(0L); mockDictionaryCalls(0L);
@ -121,7 +123,7 @@ public class RedactionIntegrationV2Test extends AbstractRedactionIntegrationTest
RedactionLogEntry redactionLogEntry = redactionLog.getRedactionLogEntry().get(0); RedactionLogEntry redactionLogEntry = redactionLog.getRedactionLogEntry().get(0);
assertThat(redactionLogEntry.getType()).isEqualTo(DICTIONARY_AUTHOR); assertThat(redactionLogEntry.getType()).isEqualTo(DICTIONARY_AUTHOR);
assertThat(redactionLogEntry.getValue()).isEqualTo(name); assertThat(redactionLogEntry.getValue()).isEqualTo(entryAuthorAndPIIDictionary);
assertThat(redactionLogEntry.isRedacted()).isEqualTo(true); assertThat(redactionLogEntry.isRedacted()).isEqualTo(true);
assertThat(redactionLogEntry.isRecommendation()).isEqualTo(false); assertThat(redactionLogEntry.isRecommendation()).isEqualTo(false);
assertThat(redactionLogEntry.isFalsePositive()).isEqualTo(false); assertThat(redactionLogEntry.isFalsePositive()).isEqualTo(false);
@ -146,8 +148,8 @@ public class RedactionIntegrationV2Test extends AbstractRedactionIntegrationTest
dictionary.clear(); dictionary.clear();
falsePositive.clear(); falsePositive.clear();
String name = "Evans P.G."; String entryAuthorDictionary = "Evans P.G.";
dictionary.put(DICTIONARY_AUTHOR, Arrays.asList(name)); dictionary.put(DICTIONARY_AUTHOR, List.of(entryAuthorDictionary));
analyzeService.analyzeDocumentStructure(new StructureAnalyzeRequest(request.getDossierId(), request.getFileId())); analyzeService.analyzeDocumentStructure(new StructureAnalyzeRequest(request.getDossierId(), request.getFileId()));
analyzeService.analyze(request); analyzeService.analyze(request);
@ -159,7 +161,7 @@ public class RedactionIntegrationV2Test extends AbstractRedactionIntegrationTest
RedactionLogEntry redactionLogEntry = redactionLog.getRedactionLogEntry().get(0); RedactionLogEntry redactionLogEntry = redactionLog.getRedactionLogEntry().get(0);
assertThat(redactionLogEntry.getType()).isEqualTo(DICTIONARY_AUTHOR); assertThat(redactionLogEntry.getType()).isEqualTo(DICTIONARY_AUTHOR);
assertThat(redactionLogEntry.getValue()).isEqualTo(name); assertThat(redactionLogEntry.getValue()).isEqualTo(entryAuthorDictionary);
assertThat(redactionLogEntry.isRedacted()).isEqualTo(true); assertThat(redactionLogEntry.isRedacted()).isEqualTo(true);
assertThat(redactionLogEntry.isRecommendation()).isEqualTo(false); assertThat(redactionLogEntry.isRecommendation()).isEqualTo(false);
assertThat(redactionLogEntry.isFalsePositive()).isEqualTo(false); assertThat(redactionLogEntry.isFalsePositive()).isEqualTo(false);