1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
package info.magnolia.module.blossom.dialog; |
35 |
|
|
36 |
|
import org.junit.Test; |
37 |
|
|
38 |
|
import static org.junit.Assert.assertEquals; |
39 |
|
import static org.junit.Assert.fail; |
40 |
|
|
41 |
|
import info.magnolia.module.blossom.annotation.DialogFactory; |
42 |
|
import info.magnolia.module.blossom.annotation.PostCreate; |
43 |
|
import info.magnolia.module.blossom.annotation.TabFactory; |
44 |
|
|
45 |
|
|
46 |
|
@link |
47 |
|
|
48 |
|
@since |
49 |
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 4 |
Complexity Density: 0.57 |
|
50 |
|
public class DialogDescriptionBuilderTest { |
51 |
|
|
52 |
|
@DialogFactory("some-dialog") |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: - |
|
53 |
|
public static class FactoryWithStaticMethod { |
54 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
55 |
0 |
@TabFactory("Margins")... |
56 |
|
public static void margins() { |
57 |
|
} |
58 |
|
} |
59 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
1PASS
|
|
60 |
1 |
@Test... |
61 |
|
public void testStaticTabFactory() throws Exception { |
62 |
1 |
try { |
63 |
1 |
new DialogDescriptionBuilder().buildDescription(new FactoryWithStaticMethod(), null); |
64 |
0 |
fail(); |
65 |
|
} catch (IllegalStateException expected) { |
66 |
|
} |
67 |
|
} |
68 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: - |
|
69 |
|
public static class DialogFactoryWithPostCreateOnStaticMethod { |
70 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
71 |
0 |
@PostCreate... |
72 |
|
public static void staticMethod() { |
73 |
|
} |
74 |
|
} |
75 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
1PASS
|
|
76 |
1 |
@Test... |
77 |
|
public void testPostCreateOnStaticMethodFails() throws Exception { |
78 |
|
|
79 |
1 |
try { |
80 |
|
|
81 |
1 |
new DialogDescriptionBuilder().buildDescription("id", "label", new DialogFactoryWithPostCreateOnStaticMethod()); |
82 |
0 |
fail(); |
83 |
|
} catch (IllegalStateException e) { |
84 |
|
|
85 |
1 |
assertEquals("PostCreate annotation is not supported on static methods", e.getMessage()); |
86 |
|
} |
87 |
|
} |
88 |
|
} |