blob: e280d1181f0998eff63ac00bfe72d6eb8ea5a496 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package org.zwobble.mammoth.tests;
import org.junit.Test;
import org.zwobble.mammoth.Mammoth;
import org.zwobble.mammoth.results.Result;
import java.io.File;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.zwobble.mammoth.results.Result.success;
import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals;
public class MammothTests {
@Test
public void emptyParagraphsAreIgnoredByDefault() {
assertThat(
convertToHtml("empty.docx").getValue(),
is(""));
}
@Test
public void docxContainingOneParagraphIsConvertedToSingleParagraphElement() {
assertThat(
convertToHtml("single-paragraph.docx"),
deepEquals(success("<p>Walking on imported air</p>")));
}
private Result<String> convertToHtml(String name) {
File file = TestData.file(name);
return Mammoth.convertToHtml(file);
}
}
|