1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.internal.transformation.macro; |
21 |
|
|
22 |
|
import java.io.PrintWriter; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import javax.inject.Named; |
26 |
|
import javax.inject.Singleton; |
27 |
|
|
28 |
|
import org.xwiki.component.annotation.Component; |
29 |
|
import org.xwiki.rendering.block.Block; |
30 |
|
import org.xwiki.rendering.macro.AbstractNoParameterMacro; |
31 |
|
import org.xwiki.rendering.macro.MacroExecutionException; |
32 |
|
import org.xwiki.rendering.transformation.MacroTransformationContext; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
@version |
38 |
|
@since |
39 |
|
|
40 |
|
@Component |
41 |
|
@Named("testfailingmacro") |
42 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 3 |
Complexity Density: 0.75 |
|
43 |
|
public class TestFailingMacro extends AbstractNoParameterMacro |
44 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
45 |
|
public class MockMacroExecutionException extends MacroExecutionException |
46 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
10 |
public MockMacroExecutionException(String message)... |
48 |
|
{ |
49 |
10 |
super(message); |
50 |
|
} |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
10 |
@Override... |
53 |
|
public void printStackTrace(PrintWriter writer) |
54 |
|
{ |
55 |
10 |
writer.print("stack trace here"); |
56 |
|
} |
57 |
|
} |
58 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
59 |
8 |
public TestFailingMacro()... |
60 |
|
{ |
61 |
8 |
super("Failing Macro"); |
62 |
8 |
setDefaultCategory("Test"); |
63 |
|
} |
64 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
5 |
@Override... |
66 |
|
public boolean supportsInlineMode() |
67 |
|
{ |
68 |
5 |
return true; |
69 |
|
} |
70 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
71 |
10 |
@Override... |
72 |
|
public List<Block> execute(Object parameters, String content, MacroTransformationContext context) |
73 |
|
throws MacroExecutionException |
74 |
|
{ |
75 |
10 |
throw new MockMacroExecutionException("Macro execution error"); |
76 |
|
} |
77 |
|
} |