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 |
|
|
27 |
|
|
28 |
|
|
29 |
|
@author |
30 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (32) |
Complexity: 6 |
Complexity Density: 0,23 |
|
31 |
|
public class UsageExpectAndDefaultReturnTest { |
32 |
|
|
33 |
|
private IMethods mock; |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
35 |
10
|
@Before... |
36 |
|
public void setup() { |
37 |
10
|
mock = createMock(IMethods.class); |
38 |
|
} |
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
40 |
2
|
@Test... |
41 |
|
public void booleanType() { |
42 |
2
|
expect(mock.booleanReturningMethod(4)).andStubReturn(true); |
43 |
2
|
replay(mock); |
44 |
2
|
assertEquals(true, mock.booleanReturningMethod(4)); |
45 |
2
|
assertEquals(true, mock.booleanReturningMethod(4)); |
46 |
2
|
verify(mock); |
47 |
|
} |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
49 |
2
|
@Test... |
50 |
|
public void longType() { |
51 |
2
|
expect(mock.longReturningMethod(4)).andStubReturn(12l); |
52 |
2
|
replay(mock); |
53 |
2
|
assertEquals(12l, mock.longReturningMethod(4)); |
54 |
2
|
assertEquals(12l, mock.longReturningMethod(4)); |
55 |
2
|
verify(mock); |
56 |
|
} |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
58 |
2
|
@Test... |
59 |
|
public void floatType() { |
60 |
2
|
expect(mock.floatReturningMethod(4)).andStubReturn(12f); |
61 |
2
|
replay(mock); |
62 |
2
|
assertEquals(12f, mock.floatReturningMethod(4), 0f); |
63 |
2
|
assertEquals(12f, mock.floatReturningMethod(4), 0f); |
64 |
2
|
verify(mock); |
65 |
|
} |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
67 |
2
|
@Test... |
68 |
|
public void doubleType() { |
69 |
2
|
expect(mock.doubleReturningMethod(4)).andStubReturn(12.0); |
70 |
2
|
replay(mock); |
71 |
2
|
assertEquals(12.0, mock.doubleReturningMethod(4), 0.0); |
72 |
2
|
assertEquals(12.0, mock.doubleReturningMethod(4), 0.0); |
73 |
2
|
verify(mock); |
74 |
|
} |
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
76 |
2
|
@Test... |
77 |
|
public void objectType() { |
78 |
2
|
expect(mock.objectReturningMethod(4)).andStubReturn("12"); |
79 |
2
|
replay(mock); |
80 |
2
|
assertEquals("12", mock.objectReturningMethod(4)); |
81 |
2
|
assertEquals("12", mock.objectReturningMethod(4)); |
82 |
2
|
verify(mock); |
83 |
|
} |
84 |
|
|
85 |
|
} |