Refactor Docx examples (#2716)
This commit is contained in:
committed by
GitHub
parent
26508f3104
commit
491649a866
@@ -1,24 +1,19 @@
|
||||
package com.baeldung.docx;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class Docx4jReadAndWriteTest {
|
||||
|
||||
String imagePath = "src/main/resources/image.jpg";
|
||||
String outputPath = "helloWorld.docx";
|
||||
|
||||
private static final String imagePath = "src/main/resources/image.jpg";
|
||||
private static final String outputPath = "helloWorld.docx";
|
||||
|
||||
@Test
|
||||
public void givenWordPackage_whenTextExist_thenReturnTrue() {
|
||||
public void givenWordPackage_whenTextExist_thenReturnTrue() throws Exception {
|
||||
Docx4jExample docx4j = new Docx4jExample();
|
||||
try {
|
||||
docx4j.createDocumentPackage(outputPath, imagePath);
|
||||
assertTrue(docx4j.isTextExist("Hello World!"));
|
||||
assertTrue(!docx4j.isTextExist("InexistantText"));
|
||||
} catch (Exception e) {
|
||||
fail();
|
||||
}
|
||||
docx4j.createDocumentPackage(outputPath, imagePath);
|
||||
assertTrue(docx4j.isTextExist("Hello World!"));
|
||||
assertTrue(!docx4j.isTextExist("InexistantText"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user