1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.configuration.internal; |
21 |
|
|
22 |
|
import org.junit.Rule; |
23 |
|
import org.junit.Test; |
24 |
|
import org.mockito.InOrder; |
25 |
|
import org.xwiki.configuration.ConfigurationSource; |
26 |
|
import org.xwiki.test.mockito.MockitoComponentMockingRule; |
27 |
|
|
28 |
|
import static org.junit.Assert.*; |
29 |
|
import static org.mockito.Mockito.*; |
30 |
|
|
31 |
|
|
32 |
|
@link |
33 |
|
|
34 |
|
@version |
35 |
|
@since |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.12 |
|
37 |
|
public class DefaultConfigurationSourceTest |
38 |
|
{ |
39 |
|
@Rule |
40 |
|
public MockitoComponentMockingRule<DefaultConfigurationSource> mocker = |
41 |
|
new MockitoComponentMockingRule<>(DefaultConfigurationSource.class); |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
43 |
1 |
@Test... |
44 |
|
public void containsKey() throws Exception |
45 |
|
{ |
46 |
1 |
ConfigurationSource documentsSource = this.mocker.getInstance(ConfigurationSource.class, "documents"); |
47 |
1 |
when(documentsSource.containsKey("key")).thenReturn(false); |
48 |
|
|
49 |
1 |
ConfigurationSource xwikiPropertiesSource = |
50 |
|
this.mocker.getInstance(ConfigurationSource.class, "xwikiproperties"); |
51 |
1 |
when(xwikiPropertiesSource.containsKey("key")).thenReturn(true); |
52 |
|
|
53 |
1 |
assertTrue(this.mocker.getComponentUnderTest().containsKey("key")); |
54 |
|
|
55 |
|
|
56 |
1 |
InOrder inOrder = inOrder(xwikiPropertiesSource, documentsSource); |
57 |
|
|
58 |
1 |
inOrder.verify(documentsSource).containsKey("key"); |
59 |
|
|
60 |
1 |
inOrder.verify(xwikiPropertiesSource).containsKey("key"); |
61 |
|
} |
62 |
|
} |