summaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth/tests/styles/BreakMatcherTests.java
blob: f33ef7232a32b42400a90f080e0c7f5a5527c0f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package org.zwobble.mammoth.tests.styles;

import org.junit.Test;
import org.zwobble.mammoth.internal.documents.Break;
import org.zwobble.mammoth.internal.styles.BreakMatcher;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

public class BreakMatcherTests {
    @Test
    public void whenBreakHasDifferentTypeToBreakMatcherThenMatchFails() {
        assertThat(BreakMatcher.LINE_BREAK.matches(Break.PAGE_BREAK), equalTo(false));
        assertThat(BreakMatcher.PAGE_BREAK.matches(Break.LINE_BREAK), equalTo(false));
    }

    @Test
    public void whenBreakHasTheSameTypeAsBreakMatcherThenMatchSucceeds() {
        assertThat(BreakMatcher.LINE_BREAK.matches(Break.LINE_BREAK), equalTo(true));
        assertThat(BreakMatcher.PAGE_BREAK.matches(Break.PAGE_BREAK), equalTo(true));
    }
}