1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.internal.macro.velocity.filter; |
21 |
|
|
22 |
|
import org.junit.Assert; |
23 |
|
|
24 |
|
import org.apache.velocity.VelocityContext; |
25 |
|
import org.junit.Test; |
26 |
|
import org.xwiki.rendering.macro.velocity.filter.VelocityMacroFilter; |
27 |
|
import org.xwiki.test.jmock.AbstractComponentTestCase; |
28 |
|
|
29 |
|
|
30 |
|
@link |
31 |
|
|
32 |
|
@version |
33 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 3 |
Complexity Density: 0.43 |
|
34 |
|
public class IndentVelocityMacroFilterTest extends AbstractComponentTestCase |
35 |
|
{ |
36 |
|
private VelocityMacroFilter filter; |
37 |
|
|
38 |
|
private VelocityContext context; |
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
40 |
1 |
@Override... |
41 |
|
protected void registerComponents() throws Exception |
42 |
|
{ |
43 |
1 |
this.filter = getComponentManager().getInstance(VelocityMacroFilter.class, "indent"); |
44 |
1 |
this.context = new VelocityContext(); |
45 |
|
} |
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
4 |
public void assertFilter(String expected, String input)... |
48 |
|
{ |
49 |
4 |
Assert.assertEquals(expected, this.filter.before(input, this.context)); |
50 |
|
} |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
52 |
1 |
@Test... |
53 |
|
public void testFilter() |
54 |
|
{ |
55 |
1 |
assertFilter("", " "); |
56 |
1 |
assertFilter("\n", " \n "); |
57 |
1 |
assertFilter("", " \t"); |
58 |
1 |
assertFilter("#if (true)\nsome text\n#end", "#if (true)\n some text\n#end"); |
59 |
|
} |
60 |
|
} |