Added missing unittest
This commit is contained in:
parent
11164219c5
commit
e1adcfb02c
@ -18,9 +18,9 @@ import com.iqser.red.service.redaction.v1.server.tableextraction.utils.Utils;
|
|||||||
@Service
|
@Service
|
||||||
public class RulingCleaningService {
|
public class RulingCleaningService {
|
||||||
|
|
||||||
public CleanRulings getCleanRulings(List<Ruling> rulings, float avgCharWidth, float avgCharHeight){
|
public CleanRulings getCleanRulings(List<Ruling> rulings, float maxCharWidth, float maxCharHeight){
|
||||||
if (!rulings.isEmpty()) {
|
if (!rulings.isEmpty()) {
|
||||||
snapPoints(rulings, avgCharWidth , avgCharHeight);
|
snapPoints(rulings, maxCharWidth , maxCharHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Ruling> vrs = new ArrayList<>();
|
List<Ruling> vrs = new ArrayList<>();
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.iqser.red.service.redaction.v1.server;
|
package com.iqser.red.service.redaction.v1.server;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT;
|
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT;
|
||||||
|
|
||||||
@ -421,6 +422,27 @@ public class RedactionIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void phantomCellsDocumentTest() throws IOException {
|
||||||
|
|
||||||
|
ClassPathResource pdfFileResource = new ClassPathResource("files/Minimal Examples/Phantom Cells.pdf");
|
||||||
|
|
||||||
|
RedactionRequest request = RedactionRequest.builder()
|
||||||
|
.document(IOUtils.toByteArray(pdfFileResource.getInputStream()))
|
||||||
|
.build();
|
||||||
|
request.setFlatRedaction(false);
|
||||||
|
|
||||||
|
RedactionResult result = redactionController.redact(request);
|
||||||
|
|
||||||
|
result.getRedactionLog().getRedactionLogEntry().forEach(entry -> {
|
||||||
|
if(!entry.isHint()){
|
||||||
|
assertThat(entry.getReason()).isEqualTo("Not redacted because row is not a vertebrate study");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static String loadFromClassPath(String path) {
|
private static String loadFromClassPath(String path) {
|
||||||
|
|
||||||
URL resource = ResourceLoader.class.getClassLoader().getResource(path);
|
URL resource = ResourceLoader.class.getClassLoader().getResource(path);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user