blob: 01f9784990ca4af98b43423248ca3681d9565a05 (
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
34
|
package org.zwobble.mammoth.tests.docx;
import org.junit.jupiter.api.Test;
import org.zwobble.mammoth.internal.docx.OfficeXml;
import org.zwobble.mammoth.internal.xml.XmlElement;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals;
import static org.zwobble.mammoth.internal.util.Lists.list;
import static org.zwobble.mammoth.internal.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(StandardCharsets.UTF_8)));
assertThat(result.getChildren(), deepEquals(list(element("fallback"))));
}
}
|