Commit ca2d2bc
authored
Update CarsAssembleTest.java (exercism#2521)
* Update CarsAssembleTest.java
Tests for Task 1 used a boolean comparison to determine whether tests pass. Replaced those with more idiomatic assertEquals(double, double, epsilon) form.
When the new style of test fails the user is shown the expected value and the actual value:
Expected :1591.2
Actual :1989.0
The previous implementation showed the user the less clear: Expected :true
Actual :false
The test implementation being replaced required the comparison to be strictly less than epsilon, not inclusive of epsilon. The JUnit assertEquals replacement check is inclusive of epsilon.
OLD: Math.abs(value1 - value2) < epsilon)
NEW: Math.abs(value1 - value2) <= epsilon
Given an epsilon of 0.0000001d this is unlikely to see any existing solutions fail given the expected answers only check the tenths place.
* Update CarsAssembleTest.java
Use AssertJ isCloseTo style assertion instead of JUnit assertEquals.1 parent 1e22361 commit ca2d2bc
1 file changed
Lines changed: 7 additions & 6 deletions
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | | - | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | | - | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | | - | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
0 commit comments