aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth/tests/docx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-01-23 20:37:05 +0000
committerMichael Williamson <mike@zwobble.org>2017-01-23 20:37:05 +0000
commit2e819654db985bf8a7e7ed76e0a43dc2f46eec8d (patch)
tree94aced195e17040ef9e616c14f52c7ce89511ddd /src/test/java/org/zwobble/mammoth/tests/docx
parent933f21dd728976f1e64cf13b5de0558efaac2911 (diff)
Handle base-relative target URIs
Diffstat (limited to 'src/test/java/org/zwobble/mammoth/tests/docx')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/docx/Uris.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/docx/Uris.java b/src/test/java/org/zwobble/mammoth/tests/docx/Uris.java
new file mode 100644
index 0000000..36d4bcb
--- /dev/null
+++ b/src/test/java/org/zwobble/mammoth/tests/docx/Uris.java
@@ -0,0 +1,25 @@
+package org.zwobble.mammoth.tests.docx;
+
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.zwobble.mammoth.internal.docx.Uris.uriToZipEntryName;
+
+public class Uris {
+ @Test
+ public void whenPathDoesNotHaveLeadingSlashThenPathIsResolvedRelativeToBase() {
+ assertThat(
+ uriToZipEntryName("one/two", "three/four"),
+ equalTo("one/two/three/four")
+ );
+ }
+
+ @Test
+ public void whenPathHasLeadingSlashThenBaseIsIgnored() {
+ assertThat(
+ uriToZipEntryName("one/two", "/three/four"),
+ equalTo("three/four")
+ );
+ }
+}