summaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth/tests/docx/Uris.java
blob: 36d4bcb5f3135938b8bd951684030f191fac8109 (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
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")
        );
    }
}