aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth/tests/styles/StyleMapParserTests.java
blob: ae2ef2b2fc63ed14576db096a7f4c5fbd1fa7b7a (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
package org.zwobble.mammoth.tests.styles;

import org.junit.Test;
import org.zwobble.mammoth.styles.HtmlPath;
import org.zwobble.mammoth.styles.ParagraphMatcher;
import org.zwobble.mammoth.styles.StyleMap;
import org.zwobble.mammoth.styles.parsing.StyleMapParser;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals;

public class StyleMapParserTests {
    @Test
    public void emptyStringIsParsedAsEmptyStyleMap() {
        StyleMap styleMap = StyleMapParser.parse("");
        assertThat(styleMap, deepEquals(StyleMap.builder().build()));
    }

    @Test
    public void canMapParagraphs() {
        StyleMap styleMap = StyleMapParser.parse("p => p");
        assertThat(styleMap, deepEquals(StyleMap.builder().mapParagraph(ParagraphMatcher.ANY, HtmlPath.EMPTY).build()));
    }
}