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.Test; |
23 |
|
|
24 |
|
|
25 |
|
@author |
26 |
|
|
|
|
| 93,8% |
Uncovered Elements: 1 (16) |
Complexity: 2 |
Complexity Density: 0,13 |
|
27 |
|
public class UsageUnorderedTest { |
28 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
29 |
|
public interface Interface { |
30 |
|
void method(int number); |
31 |
|
} |
32 |
|
|
|
|
| 93,3% |
Uncovered Elements: 1 (15) |
Complexity: 2 |
Complexity Density: 0,13 |
1
PASS
|
|
33 |
2
|
@Test... |
34 |
|
public void message() { |
35 |
2
|
final Interface mock = createMock(Interface.class); |
36 |
|
|
37 |
2
|
mock.method(anyInt()); |
38 |
2
|
expectLastCall().once(); |
39 |
2
|
mock.method(42); |
40 |
2
|
mock.method(anyInt()); |
41 |
2
|
expectLastCall().times(2); |
42 |
|
|
43 |
2
|
replay(mock); |
44 |
|
|
45 |
2
|
mock.method(6); |
46 |
2
|
mock.method(7); |
47 |
2
|
mock.method(1); |
48 |
2
|
mock.method(42); |
49 |
|
|
50 |
2
|
try { |
51 |
2
|
mock.method(42); |
52 |
0
|
fail("Should fail"); |
53 |
|
} catch (final AssertionError expected) { |
54 |
2
|
assertEquals("\n Unexpected method call method(42). Possible matches are marked with (+1):" |
55 |
|
+ "\n method(<any>): expected: 3, actual: 3 (+1)" |
56 |
|
+ "\n method(42): expected: 1, actual: 1 (+1)", expected.getMessage()); |
57 |
|
} |
58 |
|
} |
59 |
|
} |