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.assertTrue; |
29 |
|
import static org.mockito.Mockito.inOrder; |
30 |
|
import static org.mockito.Mockito.when; |
31 |
|
|
32 |
|
|
33 |
|
@link |
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.12 |
|
38 |
|
public class DocumentsConfigurationSourceTest |
39 |
|
{ |
40 |
|
@Rule |
41 |
|
public MockitoComponentMockingRule<DocumentsConfigurationSource> mocker = |
42 |
|
new MockitoComponentMockingRule<>(DocumentsConfigurationSource.class); |
43 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
44 |
1 |
@Test... |
45 |
|
public void containsKey() throws Exception |
46 |
|
{ |
47 |
1 |
ConfigurationSource wikiSource = this.mocker.getInstance(ConfigurationSource.class, "wiki"); |
48 |
1 |
when(wikiSource.containsKey("key")).thenReturn(true); |
49 |
|
|
50 |
1 |
ConfigurationSource spaceSource = this.mocker.getInstance(ConfigurationSource.class, "spaces"); |
51 |
1 |
when(spaceSource.containsKey("key")).thenReturn(false); |
52 |
|
|
53 |
1 |
assertTrue(this.mocker.getComponentUnderTest().containsKey("key")); |
54 |
|
|
55 |
|
|
56 |
1 |
InOrder inOrder = inOrder(wikiSource, spaceSource); |
57 |
|
|
58 |
1 |
inOrder.verify(spaceSource).containsKey("key"); |
59 |
|
|
60 |
1 |
inOrder.verify(wikiSource).containsKey("key"); |
61 |
|
} |
62 |
|
} |