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 java.util.Collection; |
23 |
|
|
24 |
|
import org.junit.Test; |
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
@author |
31 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 2 |
Complexity Density: 0,2 |
|
32 |
|
public class GenericTest { |
33 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
34 |
|
public interface C<U> { |
35 |
|
public void doCMethod(U u); |
36 |
|
} |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
38 |
|
public class B implements C<Integer> { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
39 |
0
|
public void doCMethod(final Integer u) {... |
40 |
0
|
fail("Should be mocked"); |
41 |
|
} |
42 |
|
} |
43 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
44 |
2
|
@Test... |
45 |
|
public void testBridgeUnmocked() { |
46 |
2
|
final B b = createMock(B.class); |
47 |
2
|
b.doCMethod(new Integer(6)); |
48 |
2
|
replay(b); |
49 |
2
|
((C<Integer>) b).doCMethod(new Integer(6)); |
50 |
2
|
verify(b); |
51 |
|
} |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
53 |
|
static abstract class AbstractFoo { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
54 |
0
|
public Collection<String> getSomeStrings() {... |
55 |
0
|
return null; |
56 |
|
} |
57 |
|
|
58 |
|
public abstract Collection<Integer> getSomeIntegers(); |
59 |
|
} |
60 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
61 |
|
public class ConcreteFoo extends AbstractFoo { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
0
|
@Override... |
63 |
|
public Collection<Integer> getSomeIntegers() { |
64 |
0
|
return null; |
65 |
|
} |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1
PASS
|
|
74 |
2
|
@Test... |
75 |
|
public void testPackageScope() { |
76 |
2
|
final ConcreteFoo b = createMock(ConcreteFoo.class); |
77 |
2
|
expect(b.getSomeStrings()).andReturn(null); |
78 |
2
|
replay(b); |
79 |
2
|
((AbstractFoo) b).getSomeStrings(); |
80 |
2
|
verify(b); |
81 |
|
} |
82 |
|
} |