aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth/tests/docx/OfficeXmlTests.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/zwobble/mammoth/tests/docx/OfficeXmlTests.java')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/docx/OfficeXmlTests.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/docx/OfficeXmlTests.java b/src/test/java/org/zwobble/mammoth/tests/docx/OfficeXmlTests.java
new file mode 100644
index 0000000..6b2fb77
--- /dev/null
+++ b/src/test/java/org/zwobble/mammoth/tests/docx/OfficeXmlTests.java
@@ -0,0 +1,34 @@
+package org.zwobble.mammoth.tests.docx;
+
+import com.google.common.base.Charsets;
+import com.google.common.collect.ImmutableList;
+import org.junit.Test;
+import org.zwobble.mammoth.docx.OfficeXml;
+import org.zwobble.mammoth.xml.XmlElement;
+
+import java.io.ByteArrayInputStream;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals;
+import static org.zwobble.mammoth.xml.XmlNodes.element;
+
+public class OfficeXmlTests {
+ @Test
+ public void alternateContentIsReplacedByContentsOfFallback() {
+ String xmlString =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
+ "<numbering xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\">" +
+ "<mc:AlternateContent>" +
+ "<mc:Choice Requires=\"w14\">" +
+ "<choice/>" +
+ "</mc:Choice>" +
+ "<mc:Fallback>" +
+ "<fallback/>" +
+ "</mc:Fallback>" +
+ "</mc:AlternateContent>" +
+ "</numbering>";
+
+ XmlElement result = OfficeXml.parseXml(new ByteArrayInputStream(xmlString.getBytes(Charsets.UTF_8)));
+ assertThat(result.children(), deepEquals(ImmutableList.of(element("fallback"))));
+ }
+}