2017-10-08 11:47:15 +01:00
|
|
|
package com.baeldung.docx;
|
|
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
2017-10-08 14:07:30 +02:00
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
|
|
2018-04-07 00:02:53 +03:00
|
|
|
public class Docx4jReadAndWriteIntegrationTest {
|
2017-10-08 11:47:15 +01:00
|
|
|
|
2017-10-08 14:07:30 +02:00
|
|
|
private static final String imagePath = "src/main/resources/image.jpg";
|
|
|
|
|
private static final String outputPath = "helloWorld.docx";
|
|
|
|
|
|
2017-10-08 11:47:15 +01:00
|
|
|
@Test
|
2017-10-08 14:07:30 +02:00
|
|
|
public void givenWordPackage_whenTextExist_thenReturnTrue() throws Exception {
|
2017-10-08 11:47:15 +01:00
|
|
|
Docx4jExample docx4j = new Docx4jExample();
|
2017-10-08 14:07:30 +02:00
|
|
|
docx4j.createDocumentPackage(outputPath, imagePath);
|
|
|
|
|
assertTrue(docx4j.isTextExist("Hello World!"));
|
|
|
|
|
assertTrue(!docx4j.isTextExist("InexistantText"));
|
2017-10-08 11:47:15 +01:00
|
|
|
}
|
|
|
|
|
}
|