| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
package org.easymock.tests; |
| 6 |
|
|
| 7 |
|
import static org.junit.Assert.*; |
| 8 |
|
|
| 9 |
|
import org.easymock.MockControl; |
| 10 |
|
import org.junit.Before; |
| 11 |
|
import org.junit.Test; |
| 12 |
|
|
| 13 |
|
@SuppressWarnings("deprecation") |
|
|
|
| 100% |
Uncovered Elements: 0 (48) |
Complexity: 6 |
Complexity Density: 0,14 |
|
| 14 |
|
public class UsageLongCompatibleReturnValueTest { |
| 15 |
|
MockControl<IMethods> control; |
| 16 |
|
|
| 17 |
|
IMethods mock; |
| 18 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
| 19 |
5
|
@Before... |
| 20 |
|
public void setup() { |
| 21 |
5
|
control = MockControl.createControl(IMethods.class); |
| 22 |
5
|
mock = control.getMock(); |
| 23 |
|
} |
| 24 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0,12 |
1
PASS
|
|
| 25 |
1
|
@Test... |
| 26 |
|
public void returnByte() { |
| 27 |
1
|
mock.byteReturningMethod(0); |
| 28 |
1
|
control.setReturnValue(25); |
| 29 |
1
|
control.setDefaultReturnValue(34); |
| 30 |
|
|
| 31 |
1
|
control.replay(); |
| 32 |
|
|
| 33 |
1
|
assertEquals((byte) 25, mock.byteReturningMethod(0)); |
| 34 |
1
|
assertEquals((byte) 34, mock.byteReturningMethod(-4)); |
| 35 |
1
|
assertEquals((byte) 34, mock.byteReturningMethod(12)); |
| 36 |
|
|
| 37 |
1
|
control.verify(); |
| 38 |
|
} |
| 39 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0,12 |
1
PASS
|
|
| 40 |
1
|
@Test... |
| 41 |
|
public void returnShort() { |
| 42 |
1
|
mock.shortReturningMethod(0); |
| 43 |
1
|
control.setReturnValue(25); |
| 44 |
1
|
control.setDefaultReturnValue(34); |
| 45 |
|
|
| 46 |
1
|
control.replay(); |
| 47 |
|
|
| 48 |
1
|
assertEquals((short) 25, mock.shortReturningMethod(0)); |
| 49 |
1
|
assertEquals((short) 34, mock.shortReturningMethod(-4)); |
| 50 |
1
|
assertEquals((short) 34, mock.shortReturningMethod(12)); |
| 51 |
|
|
| 52 |
1
|
control.verify(); |
| 53 |
|
} |
| 54 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0,12 |
1
PASS
|
|
| 55 |
1
|
@Test... |
| 56 |
|
public void returnChar() { |
| 57 |
1
|
mock.charReturningMethod(0); |
| 58 |
1
|
control.setReturnValue(25); |
| 59 |
1
|
control.setDefaultReturnValue(34); |
| 60 |
|
|
| 61 |
1
|
control.replay(); |
| 62 |
|
|
| 63 |
1
|
assertEquals((char) 25, mock.charReturningMethod(0)); |
| 64 |
1
|
assertEquals((char) 34, mock.charReturningMethod(-4)); |
| 65 |
1
|
assertEquals((char) 34, mock.charReturningMethod(12)); |
| 66 |
|
|
| 67 |
1
|
control.verify(); |
| 68 |
|
} |
| 69 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0,12 |
1
PASS
|
|
| 70 |
1
|
@Test... |
| 71 |
|
public void returnInt() { |
| 72 |
1
|
mock.intReturningMethod(0); |
| 73 |
1
|
control.setReturnValue(25); |
| 74 |
1
|
control.setDefaultReturnValue(34); |
| 75 |
|
|
| 76 |
1
|
control.replay(); |
| 77 |
|
|
| 78 |
1
|
assertEquals(25, mock.intReturningMethod(0)); |
| 79 |
1
|
assertEquals(34, mock.intReturningMethod(-4)); |
| 80 |
1
|
assertEquals(34, mock.intReturningMethod(12)); |
| 81 |
|
|
| 82 |
1
|
control.verify(); |
| 83 |
|
} |
| 84 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0,12 |
1
PASS
|
|
| 85 |
1
|
@Test... |
| 86 |
|
public void returnLong() { |
| 87 |
1
|
mock.longReturningMethod(0); |
| 88 |
1
|
control.setReturnValue(25); |
| 89 |
1
|
control.setDefaultReturnValue(34); |
| 90 |
|
|
| 91 |
1
|
control.replay(); |
| 92 |
|
|
| 93 |
1
|
assertEquals((long) 25, mock.longReturningMethod(0)); |
| 94 |
1
|
assertEquals((long) 34, mock.longReturningMethod(-4)); |
| 95 |
1
|
assertEquals((long) 34, mock.longReturningMethod(12)); |
| 96 |
|
|
| 97 |
1
|
control.verify(); |
| 98 |
|
} |
| 99 |
|
} |