| 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 (21) |
Complexity: 3 |
Complexity Density: 0,17 |
|
| 14 |
|
public class UsageFloatingPointReturnValueTest { |
| 15 |
|
MockControl<IMethods> control; |
| 16 |
|
|
| 17 |
|
IMethods mock; |
| 18 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
| 19 |
2
|
@Before... |
| 20 |
|
public void setup() { |
| 21 |
2
|
control = MockControl.createControl(IMethods.class); |
| 22 |
2
|
mock = control.getMock(); |
| 23 |
|
} |
| 24 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0,12 |
1
PASS
|
|
| 25 |
1
|
@Test... |
| 26 |
|
public void returnFloat() { |
| 27 |
1
|
mock.floatReturningMethod(0); |
| 28 |
1
|
control.setReturnValue(25.0F); |
| 29 |
1
|
control.setDefaultReturnValue(34.0F); |
| 30 |
|
|
| 31 |
1
|
control.replay(); |
| 32 |
|
|
| 33 |
1
|
assertEquals(25.0F, mock.floatReturningMethod(0), 0.0F); |
| 34 |
1
|
assertEquals(34.0F, mock.floatReturningMethod(-4), 0.0F); |
| 35 |
1
|
assertEquals(34.0F, mock.floatReturningMethod(12), 0.0F); |
| 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 returnDouble() { |
| 42 |
1
|
mock.doubleReturningMethod(0); |
| 43 |
1
|
control.setReturnValue(25.0); |
| 44 |
1
|
control.setDefaultReturnValue(34.0); |
| 45 |
|
|
| 46 |
1
|
control.replay(); |
| 47 |
|
|
| 48 |
1
|
assertEquals(25.0, mock.doubleReturningMethod(0), 0.0); |
| 49 |
1
|
assertEquals(34.0, mock.doubleReturningMethod(-4), 0.0); |
| 50 |
1
|
assertEquals(34.0, mock.doubleReturningMethod(12), 0.0); |
| 51 |
|
|
| 52 |
1
|
control.verify(); |
| 53 |
|
} |
| 54 |
|
} |