1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.macro.python; |
21 |
|
|
22 |
|
import javax.script.ScriptContext; |
23 |
|
import javax.script.SimpleScriptContext; |
24 |
|
|
25 |
|
import org.jmock.Expectations; |
26 |
|
import org.jmock.Mockery; |
27 |
|
import org.jmock.integration.junit4.JUnit4Mockery; |
28 |
|
import org.junit.runner.RunWith; |
29 |
|
import org.xwiki.rendering.macro.script.ScriptMockSetup; |
30 |
|
import org.xwiki.rendering.test.integration.RenderingTestSuite; |
31 |
|
import org.xwiki.script.ScriptContextManager; |
32 |
|
import org.xwiki.test.jmock.MockingComponentManager; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@link |
37 |
|
|
38 |
|
@version |
39 |
|
@since |
40 |
|
|
41 |
|
@RunWith(RenderingTestSuite.class) |
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
42 |
|
public class IntegrationTests |
43 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
44 |
3 |
@RenderingTestSuite.Initialized... |
45 |
|
public void initialize(MockingComponentManager cm) throws Exception |
46 |
|
{ |
47 |
3 |
Mockery mockery = new JUnit4Mockery(); |
48 |
|
|
49 |
3 |
new ScriptMockSetup(mockery, cm); |
50 |
|
|
51 |
|
|
52 |
3 |
final ScriptContextManager scm = cm.registerMockComponent(mockery, ScriptContextManager.class); |
53 |
3 |
final SimpleScriptContext scriptContext = new SimpleScriptContext(); |
54 |
3 |
scriptContext.setAttribute("var", "value", ScriptContext.ENGINE_SCOPE); |
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
55 |
3 |
mockery.checking(new Expectations() {{... |
56 |
3 |
allowing(scm).getScriptContext(); will(returnValue(scriptContext)); |
57 |
|
}}); |
58 |
|
} |
59 |
|
} |