aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth/tests/docx/Uris.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/zwobble/mammoth/tests/docx/Uris.java')
-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")
+ );
+ }
+}