1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.context.internal; |
21 |
|
|
22 |
|
import org.junit.Assert; |
23 |
|
import org.junit.Test; |
24 |
|
import org.xwiki.context.Execution; |
25 |
|
import org.xwiki.context.ExecutionContext; |
26 |
|
|
27 |
|
|
28 |
|
@link |
29 |
|
|
30 |
|
@version |
31 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (23) |
Complexity: 2 |
Complexity Density: 0.1 |
|
32 |
|
public class DefaultExecutionTest |
33 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
34 |
1 |
@Test... |
35 |
|
public void setContext() throws Exception |
36 |
|
{ |
37 |
1 |
Execution execution = new DefaultExecution(); |
38 |
|
|
39 |
1 |
Assert.assertNull(execution.getContext()); |
40 |
|
|
41 |
1 |
ExecutionContext context1 = new ExecutionContext(); |
42 |
|
|
43 |
1 |
execution.setContext(context1); |
44 |
|
|
45 |
1 |
Assert.assertSame(context1, execution.getContext()); |
46 |
|
|
47 |
1 |
ExecutionContext context2 = new ExecutionContext(); |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
1 |
execution.pushContext(context2); |
52 |
|
|
53 |
1 |
Assert.assertSame(context2, execution.getContext()); |
54 |
|
|
55 |
|
|
56 |
|
|
57 |
1 |
ExecutionContext context3 = new ExecutionContext(); |
58 |
|
|
59 |
1 |
execution.setContext(context3); |
60 |
|
|
61 |
1 |
Assert.assertSame(context3, execution.getContext()); |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
1 |
execution.popContext(); |
66 |
|
|
67 |
1 |
Assert.assertSame(context1, execution.getContext()); |
68 |
|
|
69 |
|
|
70 |
|
|
71 |
1 |
execution.popContext(); |
72 |
|
|
73 |
1 |
Assert.assertNull(execution.getContext()); |
74 |
|
} |
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
76 |
1 |
@Test... |
77 |
|
public void removeContext() throws Exception |
78 |
|
{ |
79 |
1 |
Execution execution = new DefaultExecution(); |
80 |
|
|
81 |
1 |
execution.pushContext(new ExecutionContext()); |
82 |
1 |
execution.pushContext(new ExecutionContext()); |
83 |
1 |
execution.pushContext(new ExecutionContext()); |
84 |
|
|
85 |
1 |
execution.removeContext(); |
86 |
|
|
87 |
1 |
Assert.assertNull(execution.getContext()); |
88 |
|
} |
89 |
|
} |