1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.block.match; |
21 |
|
|
22 |
|
import java.util.Arrays; |
23 |
|
import java.util.Collections; |
24 |
|
|
25 |
|
import org.junit.Assert; |
26 |
|
import org.junit.Test; |
27 |
|
import org.xwiki.rendering.block.Block; |
28 |
|
import org.xwiki.rendering.block.FormatBlock; |
29 |
|
import org.xwiki.rendering.block.GroupBlock; |
30 |
|
import org.xwiki.rendering.block.WordBlock; |
31 |
|
import org.xwiki.rendering.listener.Format; |
32 |
|
|
33 |
|
|
34 |
|
@link |
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
39 |
|
public class OrBlockMatcherTest |
40 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
41 |
1 |
@Test... |
42 |
|
public void matchWhenUsingVarargConstructor() |
43 |
|
{ |
44 |
1 |
OrBlockMatcher matcher = new OrBlockMatcher( |
45 |
|
new ClassBlockMatcher(GroupBlock.class), |
46 |
|
new ClassBlockMatcher(FormatBlock.class)); |
47 |
|
|
48 |
1 |
Assert.assertTrue(matcher.match(new GroupBlock())); |
49 |
1 |
Assert.assertTrue(matcher.match(new FormatBlock(Collections.<Block>emptyList(), Format.BOLD))); |
50 |
1 |
Assert.assertFalse(matcher.match(new WordBlock("test"))); |
51 |
|
} |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
53 |
1 |
@Test... |
54 |
|
public void matchWhenUsingListConstructor() |
55 |
|
{ |
56 |
1 |
OrBlockMatcher matcher = new OrBlockMatcher(Arrays.<BlockMatcher>asList( |
57 |
|
new ClassBlockMatcher(GroupBlock.class), |
58 |
|
new ClassBlockMatcher(FormatBlock.class))); |
59 |
|
|
60 |
1 |
Assert.assertTrue(matcher.match(new GroupBlock())); |
61 |
1 |
Assert.assertTrue(matcher.match(new FormatBlock(Collections.<Block>emptyList(), Format.BOLD))); |
62 |
1 |
Assert.assertFalse(matcher.match(new WordBlock("test"))); |
63 |
|
} |
64 |
|
} |