1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.lesscss.internal; |
21 |
|
|
22 |
|
import org.junit.Before; |
23 |
|
import org.junit.Rule; |
24 |
|
import org.junit.Test; |
25 |
|
import org.xwiki.context.Execution; |
26 |
|
import org.xwiki.context.ExecutionContext; |
27 |
|
import org.xwiki.test.mockito.MockitoComponentMockingRule; |
28 |
|
|
29 |
|
import static org.junit.Assert.assertFalse; |
30 |
|
import static org.junit.Assert.assertTrue; |
31 |
|
import static org.mockito.Mockito.when; |
32 |
|
|
33 |
|
|
34 |
|
@link |
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 5 |
Complexity Density: 0.26 |
|
39 |
|
public class LESSContextTest |
40 |
|
{ |
41 |
|
@Rule |
42 |
|
public MockitoComponentMockingRule<LESSContext> mocker = |
43 |
|
new MockitoComponentMockingRule<>(LESSContext.class); |
44 |
|
|
45 |
|
private Execution execution; |
46 |
|
|
47 |
|
private ExecutionContext executionContext; |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
49 |
4 |
@Before... |
50 |
|
public void setUp() throws Exception |
51 |
|
{ |
52 |
4 |
execution = mocker.getInstance(Execution.class); |
53 |
4 |
executionContext = new ExecutionContext(); |
54 |
4 |
when(execution.getContext()).thenReturn(executionContext); |
55 |
|
} |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
57 |
1 |
@Test... |
58 |
|
public void disableCache() throws Exception |
59 |
|
{ |
60 |
1 |
mocker.getComponentUnderTest().disableCache(); |
61 |
1 |
assertTrue((Boolean)executionContext.getProperty("less.cache.disable")); |
62 |
|
} |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
64 |
1 |
@Test... |
65 |
|
public void stopDisablingCache() throws Exception |
66 |
|
{ |
67 |
1 |
mocker.getComponentUnderTest().disableCache(); |
68 |
1 |
assertTrue((Boolean) executionContext.getProperty("less.cache.disable")); |
69 |
1 |
mocker.getComponentUnderTest().stopDisablingCache(); |
70 |
1 |
assertFalse((Boolean)executionContext.getProperty("less.cache.disable")); |
71 |
|
} |
72 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
73 |
1 |
@Test... |
74 |
|
public void isCacheDisabled() throws Exception |
75 |
|
{ |
76 |
1 |
assertFalse(mocker.getComponentUnderTest().isCacheDisabled()); |
77 |
1 |
mocker.getComponentUnderTest().disableCache(); |
78 |
1 |
assertTrue(mocker.getComponentUnderTest().isCacheDisabled()); |
79 |
1 |
mocker.getComponentUnderTest().stopDisablingCache(); |
80 |
1 |
assertFalse(mocker.getComponentUnderTest().isCacheDisabled()); |
81 |
|
} |
82 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
83 |
1 |
@Test... |
84 |
|
public void setHTMLExport() throws Exception |
85 |
|
{ |
86 |
1 |
assertFalse(mocker.getComponentUnderTest().isHtmlExport()); |
87 |
1 |
mocker.getComponentUnderTest().setHtmlExport(true); |
88 |
1 |
assertTrue(mocker.getComponentUnderTest().isHtmlExport()); |
89 |
1 |
mocker.getComponentUnderTest().setHtmlExport(false); |
90 |
1 |
assertFalse(mocker.getComponentUnderTest().isHtmlExport()); |
91 |
|
} |
92 |
|
|
93 |
|
} |