aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth/tests/html/HtmlWriteTests.java
blob: 9ce869dd7793edd3d2744f1c232f453d60808376 (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
27
28
package org.zwobble.mammoth.tests.html;

import org.junit.Test;
import org.zwobble.mammoth.html.Html;
import org.zwobble.mammoth.html.HtmlNode;

import static org.junit.Assert.assertEquals;
import static org.zwobble.mammoth.util.MammothLists.list;

public class HtmlWriteTests {
    @Test
    public void textNodesAreWrittenAsPlainText() {
        assertEquals(
            "Dark Blue",
            write(Html.text("Dark Blue")));
    }

    @Test
    public void textNodesAreHtmlEscaped() {
        assertEquals(
            "><&",
            write(Html.text("><&")));
    }

    private String write(HtmlNode node) {
        return Html.write(list(node));
    }
}