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.configuration; |
21 |
|
|
22 |
|
import java.util.Arrays; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import org.junit.Rule; |
26 |
|
import org.junit.Test; |
27 |
|
import org.xwiki.configuration.ConfigurationSource; |
28 |
|
import org.xwiki.test.mockito.MockitoComponentMockingRule; |
29 |
|
|
30 |
|
import static org.junit.Assert.*; |
31 |
|
import static org.mockito.Mockito.*; |
32 |
|
|
33 |
|
|
34 |
|
@link |
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
39 |
|
public class XWikiRenderingConfigurationTest |
40 |
|
{ |
41 |
|
@Rule |
42 |
|
public MockitoComponentMockingRule<XWikiRenderingConfiguration> mocker = |
43 |
|
new MockitoComponentMockingRule<>(XWikiRenderingConfiguration.class); |
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
45 |
1 |
@Test... |
46 |
|
public void getLinkLabelFormat() throws Exception |
47 |
|
{ |
48 |
1 |
ConfigurationSource source = this.mocker.getInstance(ConfigurationSource.class); |
49 |
1 |
when(source.getProperty("rendering.linkLabelFormat", "%np")).thenReturn("%np"); |
50 |
|
|
51 |
1 |
assertEquals("%np", this.mocker.getComponentUnderTest().getLinkLabelFormat()); |
52 |
|
} |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
54 |
1 |
@Test... |
55 |
|
public void getTransformationNames() throws Exception |
56 |
|
{ |
57 |
1 |
ConfigurationSource source = this.mocker.getInstance(ConfigurationSource.class); |
58 |
1 |
when(source.getProperty("rendering.transformations", Arrays.asList("macro", "icon"))).thenReturn( |
59 |
|
Arrays.asList("mytransformation")); |
60 |
|
|
61 |
1 |
List<String> txs = this.mocker.getComponentUnderTest().getTransformationNames(); |
62 |
1 |
assertEquals(1, txs.size()); |
63 |
1 |
assertEquals("mytransformation", txs.get(0)); |
64 |
|
} |
65 |
|
} |