1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.easymock.tests; |
18 |
|
|
19 |
|
import static org.easymock.EasyMock.*; |
20 |
|
import static org.junit.Assert.*; |
21 |
|
|
22 |
|
import org.junit.Before; |
23 |
|
import org.junit.Test; |
24 |
|
|
25 |
|
|
26 |
|
@author |
27 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (112) |
Complexity: 21 |
Complexity Density: 0,23 |
|
28 |
|
public class UsageExpectAndReturnTest { |
29 |
|
|
30 |
|
private IMethods mock; |
31 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
32 |
40
|
@Before... |
33 |
|
public void setup() { |
34 |
40
|
mock = createMock(IMethods.class); |
35 |
|
} |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
1
PASS
|
|
37 |
2
|
@Test... |
38 |
|
public void booleanType() { |
39 |
2
|
expect(mock.booleanReturningMethod(4)).andReturn(true); |
40 |
2
|
replay(mock); |
41 |
2
|
assertEquals(true, mock.booleanReturningMethod(4)); |
42 |
2
|
verify(mock); |
43 |
|
} |
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
1
PASS
|
|
45 |
2
|
@Test... |
46 |
|
public void longType() { |
47 |
2
|
expect(mock.longReturningMethod(4)).andReturn(12l); |
48 |
2
|
replay(mock); |
49 |
2
|
assertEquals(12, mock.longReturningMethod(4)); |
50 |
2
|
verify(mock); |
51 |
|
} |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
1
PASS
|
|
53 |
2
|
@Test... |
54 |
|
public void floatType() { |
55 |
2
|
expect(mock.floatReturningMethod(4)).andReturn(12f); |
56 |
2
|
replay(mock); |
57 |
2
|
assertEquals(12f, mock.floatReturningMethod(4), 0f); |
58 |
2
|
verify(mock); |
59 |
|
} |
60 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
1
PASS
|
|
61 |
2
|
@Test... |
62 |
|
public void doubleType() { |
63 |
2
|
expect(mock.doubleReturningMethod(4)).andReturn(12.0); |
64 |
2
|
replay(mock); |
65 |
2
|
assertEquals(12.0, mock.doubleReturningMethod(4), 0.0); |
66 |
2
|
verify(mock); |
67 |
|
} |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
1
PASS
|
|
69 |
2
|
@Test... |
70 |
|
public void object() { |
71 |
2
|
expect(mock.objectReturningMethod(4)).andReturn("12"); |
72 |
2
|
replay(mock); |
73 |
2
|
assertEquals("12", mock.objectReturningMethod(4)); |
74 |
2
|
verify(mock); |
75 |
|
} |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
1
PASS
|
|
77 |
2
|
@Test... |
78 |
|
public void booleanAndRange() { |
79 |
2
|
expect(mock.booleanReturningMethod(4)).andReturn(true).once(); |
80 |
2
|
replay(mock); |
81 |
2
|
assertEquals(true, mock.booleanReturningMethod(4)); |
82 |
2
|
verify(mock); |
83 |
|
} |
84 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
1
PASS
|
|
85 |
2
|
@Test... |
86 |
|
public void longAndRange() { |
87 |
2
|
expect(mock.longReturningMethod(4)).andReturn(12l).once(); |
88 |
2
|
replay(mock); |
89 |
2
|
assertEquals(12, mock.longReturningMethod(4)); |
90 |
2
|
verify(mock); |
91 |
|
} |
92 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
1
PASS
|
|
93 |
2
|
@Test... |
94 |
|
public void floatAndRange() { |
95 |
2
|
expect(mock.floatReturningMethod(4)).andReturn(12f).once(); |
96 |
2
|
replay(mock); |
97 |
2
|
assertEquals(12f, mock.floatReturningMethod(4), 0f); |
98 |
2
|
verify(mock); |
99 |
|
} |
100 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
1
PASS
|
|
101 |
2
|
@Test... |
102 |
|
public void doubleAndRange() { |
103 |
2
|
expect(mock.doubleReturningMethod(4)).andReturn(12.0).once(); |
104 |
2
|
replay(mock); |
105 |
2
|
assertEquals(12.0, mock.doubleReturningMethod(4), 0.0); |
106 |
2
|
verify(mock); |
107 |
|
} |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
1
PASS
|
|
109 |
2
|
@Test... |
110 |
|
public void objectAndRange() { |
111 |
2
|
expect(mock.objectReturningMethod(4)).andReturn("12").once(); |
112 |
2
|
replay(mock); |
113 |
2
|
assertEquals("12", mock.objectReturningMethod(4)); |
114 |
2
|
verify(mock); |
115 |
|
} |
116 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
117 |
2
|
@Test... |
118 |
|
public void booleanAndCount() { |
119 |
2
|
expect(mock.booleanReturningMethod(4)).andReturn(true).times(2); |
120 |
2
|
replay(mock); |
121 |
2
|
assertEquals(true, mock.booleanReturningMethod(4)); |
122 |
2
|
assertEquals(true, mock.booleanReturningMethod(4)); |
123 |
2
|
verify(mock); |
124 |
|
} |
125 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
126 |
2
|
@Test... |
127 |
|
public void longAndCount() { |
128 |
2
|
expect(mock.longReturningMethod(4)).andReturn(12l).times(2); |
129 |
2
|
replay(mock); |
130 |
2
|
assertEquals(12, mock.longReturningMethod(4)); |
131 |
2
|
assertEquals(12, mock.longReturningMethod(4)); |
132 |
2
|
verify(mock); |
133 |
|
} |
134 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
135 |
2
|
@Test... |
136 |
|
public void floatAndCount() { |
137 |
2
|
expect(mock.floatReturningMethod(4)).andReturn(12f).times(2); |
138 |
2
|
replay(mock); |
139 |
2
|
assertEquals(12f, mock.floatReturningMethod(4), 0f); |
140 |
2
|
assertEquals(12f, mock.floatReturningMethod(4), 0f); |
141 |
2
|
verify(mock); |
142 |
|
} |
143 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
144 |
2
|
@Test... |
145 |
|
public void doubleAndCount() { |
146 |
2
|
expect(mock.doubleReturningMethod(4)).andReturn(12.0).times(2); |
147 |
2
|
replay(mock); |
148 |
2
|
assertEquals(12.0, mock.doubleReturningMethod(4), 0.0); |
149 |
2
|
assertEquals(12.0, mock.doubleReturningMethod(4), 0.0); |
150 |
2
|
verify(mock); |
151 |
|
} |
152 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
153 |
2
|
@Test... |
154 |
|
public void objectAndCount() { |
155 |
2
|
expect(mock.objectReturningMethod(4)).andReturn("12").times(2); |
156 |
2
|
replay(mock); |
157 |
2
|
assertEquals("12", mock.objectReturningMethod(4)); |
158 |
2
|
assertEquals("12", mock.objectReturningMethod(4)); |
159 |
2
|
verify(mock); |
160 |
|
} |
161 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
162 |
2
|
@Test... |
163 |
|
public void booleanAndMinMax() { |
164 |
2
|
expect(mock.booleanReturningMethod(4)).andReturn(true).times(2, 3); |
165 |
2
|
replay(mock); |
166 |
2
|
assertEquals(true, mock.booleanReturningMethod(4)); |
167 |
2
|
assertEquals(true, mock.booleanReturningMethod(4)); |
168 |
2
|
verify(mock); |
169 |
|
} |
170 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
171 |
2
|
@Test... |
172 |
|
public void longAndMinMax() { |
173 |
2
|
expect(mock.longReturningMethod(4)).andReturn(12l).times(2, 3); |
174 |
2
|
replay(mock); |
175 |
2
|
assertEquals(12, mock.longReturningMethod(4)); |
176 |
2
|
assertEquals(12, mock.longReturningMethod(4)); |
177 |
2
|
verify(mock); |
178 |
|
} |
179 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
180 |
2
|
@Test... |
181 |
|
public void floatAndMinMax() { |
182 |
2
|
expect(mock.floatReturningMethod(4)).andReturn(12f).times(2, 3); |
183 |
2
|
replay(mock); |
184 |
2
|
assertEquals(12f, mock.floatReturningMethod(4), 0f); |
185 |
2
|
assertEquals(12f, mock.floatReturningMethod(4), 0f); |
186 |
2
|
verify(mock); |
187 |
|
} |
188 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
189 |
2
|
@Test... |
190 |
|
public void doubleAndMinMax() { |
191 |
2
|
expect(mock.doubleReturningMethod(4)).andReturn(12.0).times(2, 3); |
192 |
2
|
replay(mock); |
193 |
2
|
assertEquals(12.0, mock.doubleReturningMethod(4), 0.0); |
194 |
2
|
assertEquals(12.0, mock.doubleReturningMethod(4), 0.0); |
195 |
2
|
verify(mock); |
196 |
|
} |
197 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
198 |
2
|
@Test... |
199 |
|
public void objectAndMinMax() { |
200 |
2
|
expect(mock.objectReturningMethod(4)).andReturn("12").times(2, 3); |
201 |
2
|
replay(mock); |
202 |
2
|
assertEquals("12", mock.objectReturningMethod(4)); |
203 |
2
|
assertEquals("12", mock.objectReturningMethod(4)); |
204 |
2
|
verify(mock); |
205 |
|
} |
206 |
|
} |