1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package org.perfectjpattern.core.behavioral.command; |
22 |
|
|
23 |
|
import junit.framework.*; |
24 |
|
|
25 |
|
import org.perfectjpattern.core.api.behavioral.command.*; |
26 |
|
import org.slf4j.*; |
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
@see |
33 |
|
@see |
34 |
|
@see |
35 |
|
@see |
36 |
|
|
37 |
|
@author |
38 |
|
@version |
39 |
|
|
40 |
|
public |
|
|
| 70% |
Uncovered Elements: 6 (20) |
Complexity: 8 |
Complexity Density: 0.53 |
|
41 |
|
class TestInvoker |
42 |
|
extends TestCase |
43 |
|
{ |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
|
|
| 78.6% |
Uncovered Elements: 3 (14) |
Complexity: 4 |
Complexity Density: 0.29 |
1
PASS
|
|
51 |
1
|
public void ... |
52 |
|
testInvokerInvalidStateDetected() |
53 |
|
{ |
54 |
1
|
theLogger.debug("Running assertions ... "); |
55 |
|
|
56 |
|
|
57 |
1
|
IInvoker<Object, Object> myInvoker = new Invoker<Object, Object>(); |
58 |
|
|
59 |
1
|
try |
60 |
|
{ |
61 |
1
|
myInvoker.invoke(); |
62 |
0
|
fail("Invoker implementation did not detect missing ICommand"); |
63 |
|
} |
64 |
|
catch (IllegalStateException anException) |
65 |
|
{ |
66 |
|
|
67 |
|
} |
68 |
|
|
69 |
1
|
try |
70 |
|
{ |
71 |
1
|
myInvoker.getResult(); |
72 |
0
|
fail("Invoker implementation did not detect missing ICommand"); |
73 |
|
} |
74 |
|
catch (IllegalStateException anException) |
75 |
|
{ |
76 |
|
|
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
1
|
ICommand<Object, Object> myCommand = new ICommand<Object, Object>() |
81 |
|
{ |
82 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
83 |
0
|
public void ... |
84 |
|
execute() |
85 |
|
throws IllegalStateException |
86 |
|
{ |
87 |
|
|
88 |
|
} |
89 |
|
|
90 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
91 |
1
|
public Object ... |
92 |
|
getResult() |
93 |
|
throws IllegalStateException |
94 |
|
{ |
95 |
1
|
return null; |
96 |
|
} |
97 |
|
|
98 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
99 |
0
|
public void ... |
100 |
|
setParameter(Object aParameter) |
101 |
|
throws IllegalArgumentException |
102 |
|
{ |
103 |
|
|
104 |
|
} |
105 |
|
|
106 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
107 |
0
|
public void ... |
108 |
|
setReceiver(IReceiver<Object, Object> aReceiver) |
109 |
|
throws IllegalArgumentException |
110 |
|
{ |
111 |
|
|
112 |
|
} |
113 |
|
}; |
114 |
|
|
115 |
1
|
myInvoker.setCommand(myCommand); |
116 |
1
|
try |
117 |
|
{ |
118 |
1
|
myInvoker.getResult(); |
119 |
0
|
fail("Invoker implementation did not detect null IResult"); |
120 |
|
} |
121 |
|
catch (IllegalStateException anException) |
122 |
|
{ |
123 |
|
|
124 |
|
} |
125 |
|
|
126 |
1
|
theLogger.debug("Completed test"); |
127 |
|
} |
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
private final Logger theLogger = LoggerFactory.getLogger(this.getClass()); |
136 |
|
} |