diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-02-13 19:48:59 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-02-13 19:48:59 +0000 |
| commit | f63e7014a68c90160da89a25db613381edbc6e5e (patch) | |
| tree | d4e18df804a6dc5e42a9c65d7d2d0940abef4d0e /src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java | |
| parent | 7864626f385e23272bf307474ceaebe281b4ed28 (diff) | |
Read hyperlinks with href
Diffstat (limited to 'src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java index b1ce149..40b58a3 100644 --- a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java @@ -5,9 +5,7 @@ import org.hamcrest.Matcher; import org.hamcrest.Matchers; import org.junit.Test; import org.zwobble.mammoth.documents.*; -import org.zwobble.mammoth.docx.BodyXmlReader; -import org.zwobble.mammoth.docx.Numbering; -import org.zwobble.mammoth.docx.Styles; +import org.zwobble.mammoth.docx.*; import org.zwobble.mammoth.results.Result; import org.zwobble.mammoth.results.Warning; import org.zwobble.mammoth.tests.DeepReflectionMatcher; @@ -296,6 +294,16 @@ public class BodyXmlTests { deepEquals(make(a(PARAGRAPH)))); } + @Test + public void hyperlinkIsReadIfItHasARelationshipId() { + Relationships relationships = new Relationships( + map("r42", new Relationship("http://example.com"))); + XmlElement element = element("w:hyperlink", map("r:id", "r42"), list(runXml(list()))); + assertThat( + readSuccess(a(bodyReader, with(RELATIONSHIPS, relationships)), element), + deepEquals(Hyperlink.href("http://example.com", list(make(a(RUN)))))); + } + private static DocumentElement readSuccess(Maker<BodyXmlReader> reader, XmlElement element) { Result<DocumentElement> result = read(reader, element); assertThat(result.getWarnings(), deepEquals(list())); |
