blob: 4714f9a35b6ca59767f0eaad3d8fad9733b12ca9 (
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
29
30
31
32
33
34
35
36
37
38
|
package org.zwobble.mammoth.tests.styles;
import org.junit.jupiter.api.Test;
import org.zwobble.mammoth.internal.styles.HighlightMatcher;
import java.util.Optional;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
public class HighlightMatcherTests {
@Test
public void highlightMatcherWithoutColorMatchesAllHighlightElements() {
HighlightMatcher matcher = new HighlightMatcher(Optional.empty());
boolean result = matcher.matches("yellow");
assertThat(result, equalTo(true));
}
@Test
public void highlightMatcherWithColorMatchesHighlightWithThatColor() {
HighlightMatcher matcher = new HighlightMatcher(Optional.of("yellow"));
boolean result = matcher.matches("yellow");
assertThat(result, equalTo(true));
}
@Test
public void highlightMatcherWithColorDoesNotMatchHighlightsWithOtherColors() {
HighlightMatcher matcher = new HighlightMatcher(Optional.of("yellow"));
boolean result = matcher.matches("red");
assertThat(result, equalTo(false));
}
}
|