Skip to content

Commit 536fe6a

Browse files
committed
Refactor MultiThreadingTest test to reuse code from IntegrationTestHelper
1 parent 0809348 commit 536fe6a

File tree

1 file changed

+3
-30
lines changed

1 file changed

+3
-30
lines changed

pdfocr-tesseract4/src/test/java/com/itextpdf/pdfocr/events/multithreading/MultiThreadingTest.java

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ This file is part of the iText (R) project.
2929
import com.itextpdf.kernel.counter.event.IEvent;
3030
import com.itextpdf.kernel.counter.event.IMetaInfo;
3131
import com.itextpdf.metainfo.TestMetaInfo;
32+
import com.itextpdf.pdfocr.IntegrationTestHelper;
3233
import com.itextpdf.pdfocr.tesseract4.AbstractTesseract4OcrEngine;
33-
import com.itextpdf.pdfocr.tesseract4.Tesseract4ExecutableOcrEngine;
34-
import com.itextpdf.pdfocr.tesseract4.Tesseract4LibOcrEngine;
3534
import com.itextpdf.pdfocr.tesseract4.Tesseract4OcrEngineProperties;
3635
import com.itextpdf.pdfocr.tesseract4.events.PdfOcrTesseract4Event;
37-
import com.itextpdf.test.ExtendedITextTest;
3836
import com.itextpdf.test.annotations.type.IntegrationTest;
3937

4038
import java.io.File;
@@ -49,29 +47,16 @@ This file is part of the iText (R) project.
4947
import org.junit.rules.ExpectedException;
5048

5149
@Category(IntegrationTest.class)
52-
public abstract class MultiThreadingTest extends ExtendedITextTest {
50+
public abstract class MultiThreadingTest extends IntegrationTestHelper {
5351
protected static final String destinationFolder = "./target/test/com/itextpdf/pdfocr/events/multithreading/";
5452
protected static final String sourceFolder = "./src/test/resources/com/itextpdf/pdfocr/events/multithreading/";
5553

56-
private AbstractTesseract4OcrEngine tesseractReader;
57-
private String testFileTypeName;
58-
private boolean isExecutableReaderType;
59-
60-
private static Tesseract4LibOcrEngine tesseractLibReader = new Tesseract4LibOcrEngine(
61-
new Tesseract4OcrEngineProperties());
62-
private static Tesseract4ExecutableOcrEngine tesseractExecutableReader = new Tesseract4ExecutableOcrEngine(
63-
new Tesseract4OcrEngineProperties());
54+
AbstractTesseract4OcrEngine tesseractReader;
6455

6556
@Rule
6657
public ExpectedException junitExpectedException = ExpectedException.none();
6758

6859
public MultiThreadingTest(ReaderType type) {
69-
isExecutableReaderType = type.equals(ReaderType.EXECUTABLE);
70-
if (isExecutableReaderType) {
71-
testFileTypeName = "executable";
72-
} else {
73-
testFileTypeName = "lib";
74-
}
7560
tesseractReader = getTesseractReader(type);
7661
}
7762

@@ -80,14 +65,6 @@ public static void beforeClass() {
8065
createDestinationFolder(destinationFolder);
8166
}
8267

83-
protected static AbstractTesseract4OcrEngine getTesseractReader(ReaderType type) {
84-
if (type.equals(ReaderType.LIB)) {
85-
return tesseractLibReader;
86-
} else {
87-
return tesseractExecutableReader;
88-
}
89-
}
90-
9168
@Before
9269
public void initTesseractProperties() {
9370
Tesseract4OcrEngineProperties ocrEngineProperties =
@@ -168,8 +145,4 @@ protected void onEvent(IEvent event, IMetaInfo metaInfo) {
168145
}
169146
}
170147

171-
public enum ReaderType {
172-
LIB,
173-
EXECUTABLE
174-
}
175148
}

0 commit comments

Comments
 (0)