aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth/tests/docx/RelationshipsXmlTests.java
blob: 63135913d69d8b5f3a8b5a164b8418d800634a32 (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
package org.zwobble.mammoth.tests.docx;

import org.junit.jupiter.api.Test;
import org.zwobble.mammoth.internal.docx.Relationships;
import org.zwobble.mammoth.internal.xml.XmlElement;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.zwobble.mammoth.internal.docx.RelationshipsXml.readRelationshipsXmlElement;
import static org.zwobble.mammoth.internal.util.Lists.list;
import static org.zwobble.mammoth.internal.util.Maps.map;
import static org.zwobble.mammoth.internal.xml.XmlNodes.element;

public class RelationshipsXmlTests {
    @Test
    public void targetIsReadFromRelationshipElement() {
        XmlElement element = element("relationship:Relationships", list(
            element("relationships:Relationship", map(
                "Id", "rId8",
                "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
                "Target", "http://example.com"))));

        Relationships relationships = readRelationshipsXmlElement(element);

        assertEquals("http://example.com", relationships.findRelationshipById("rId8").getTarget());
    }
}