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 |
|
|
21 |
|
import org.easymock.EasyMock; |
22 |
|
import org.easymock.IExpectationSetters; |
23 |
|
import org.easymock.IMocksControl; |
24 |
|
import org.easymock.internal.ReplayState; |
25 |
|
import org.junit.Before; |
26 |
|
import org.junit.Test; |
27 |
|
|
28 |
|
|
29 |
|
@author |
30 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (31) |
Complexity: 13 |
Complexity Density: 0,72 |
|
31 |
|
public class ReplayStateInvalidUsageTest { |
32 |
|
|
33 |
|
private IMethods mock; |
34 |
|
|
35 |
|
private Exception exception; |
36 |
|
|
37 |
|
private ReplayState replayState; |
38 |
|
|
39 |
|
private IMocksControl mocksControl; |
40 |
|
|
41 |
|
private IExpectationSetters<String> expectationSetters; |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0,17 |
|
43 |
24
|
@SuppressWarnings("unchecked")... |
44 |
|
@Before |
45 |
|
public void setUp() { |
46 |
24
|
exception = new Exception(); |
47 |
24
|
mock = EasyMock.createMock(IMethods.class); |
48 |
24
|
EasyMock.replay(mock); |
49 |
24
|
mocksControl = EasyMock.createControl(); |
50 |
24
|
mocksControl.replay(); |
51 |
24
|
expectationSetters = (IExpectationSetters<String>) mocksControl; |
52 |
|
} |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
54 |
2
|
@Test(expected = IllegalStateException.class)... |
55 |
|
public void setVoidCallable() { |
56 |
2
|
expectLastCall(); |
57 |
|
} |
58 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
59 |
2
|
@Test(expected = IllegalStateException.class)... |
60 |
|
public void replay() { |
61 |
2
|
EasyMock.replay(mock); |
62 |
|
} |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
64 |
2
|
@Test(expected = IllegalStateException.class)... |
65 |
|
public void createMock() { |
66 |
2
|
mocksControl.createMock(IMethods.class); |
67 |
|
} |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
69 |
2
|
@Test(expected = IllegalStateException.class)... |
70 |
|
public void createMockWithName() { |
71 |
2
|
mocksControl.createMock("", IMethods.class); |
72 |
|
} |
73 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
74 |
2
|
@Test(expected = IllegalStateException.class)... |
75 |
|
public void checkOrder() { |
76 |
2
|
mocksControl.checkOrder(true); |
77 |
|
} |
78 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
79 |
2
|
@Test(expected = IllegalStateException.class)... |
80 |
|
public void makeThreadSafe() { |
81 |
2
|
mocksControl.makeThreadSafe(true); |
82 |
|
} |
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
84 |
2
|
@Test(expected = IllegalStateException.class)... |
85 |
|
public void checkIsUsedInOneThread() { |
86 |
2
|
mocksControl.checkIsUsedInOneThread(true); |
87 |
|
} |
88 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
89 |
2
|
@Test(expected = IllegalStateException.class)... |
90 |
|
public void andStubReturn() { |
91 |
2
|
expectationSetters.andStubReturn("7"); |
92 |
|
} |
93 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
94 |
2
|
@Test(expected = IllegalStateException.class)... |
95 |
|
public void andStubThrow() { |
96 |
2
|
expectationSetters.andStubThrow(new RuntimeException()); |
97 |
|
} |
98 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
99 |
2
|
@Test(expected = IllegalStateException.class)... |
100 |
|
public void asStub() { |
101 |
2
|
expectationSetters.asStub(); |
102 |
|
} |
103 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
104 |
2
|
@Test(expected = IllegalStateException.class)... |
105 |
|
public void times() { |
106 |
2
|
expectationSetters.times(3); |
107 |
|
} |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
109 |
2
|
@Test(expected = IllegalStateException.class)... |
110 |
|
public void anyTimes() { |
111 |
2
|
expectationSetters.anyTimes(); |
112 |
|
} |
113 |
|
} |