blob: 2b6323ec06d00f57cb7c948b4b1c6ec8e020cde4 (
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
|
package org.zwobble.mammoth.tests.docx;
import com.google.common.collect.ImmutableList;
import org.hamcrest.Matcher;
import org.junit.Test;
import org.zwobble.mammoth.documents.DocumentElement;
import org.zwobble.mammoth.documents.TextElement;
import org.zwobble.mammoth.xml.XmlElement;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.zwobble.mammoth.docx.BodyXml.readBodyXmlElement;
import static org.zwobble.mammoth.xml.XmlNodes.element;
import static org.zwobble.mammoth.xml.XmlNodes.text;
public class BodyXmlTests {
@Test
public void textFromTextElementIsRead() {
XmlElement element = element("w:t", ImmutableList.of(text("Hello!")));
assertThat(readBodyXmlElement(element), isTextElement("Hello!"));
}
private Matcher<DocumentElement> isTextElement(String value) {
return allOf(
instanceOf(TextElement.class),
hasProperty("value", equalTo(value)));
}
}
|