|
|
@@ -23,21 +23,21 @@ public class BookStoreTest {
|
|
23
|
23
|
@Test
|
|
24
|
24
|
public void onlyASingleBook() {
|
|
25
|
25
|
List<Integer> books = Collections.singletonList(1);
|
|
26
|
|
- assertEquals(8, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
|
26
|
+ assertEquals(8.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
27
|
27
|
}
|
|
28
|
28
|
|
|
29
|
29
|
@Ignore("Remove to run test")
|
|
30
|
30
|
@Test
|
|
31
|
31
|
public void twoOfSameBook() {
|
|
32
|
|
- List<Integer> books = Arrays.asList(1, 1);
|
|
33
|
|
- assertEquals(16, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
|
32
|
+ List<Integer> books = Arrays.asList(2, 2);
|
|
|
33
|
+ assertEquals(16.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
34
|
34
|
}
|
|
35
|
35
|
|
|
36
|
36
|
@Ignore("Remove to run test")
|
|
37
|
37
|
@Test
|
|
38
|
38
|
public void emptyBasket() {
|
|
39
|
39
|
List<Integer> books = Collections.emptyList();
|
|
40
|
|
- assertEquals(0, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
|
40
|
+ assertEquals(0.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
41
|
41
|
}
|
|
42
|
42
|
|
|
43
|
43
|
@Ignore("Remove to run test")
|
|
|
@@ -51,21 +51,21 @@ public class BookStoreTest {
|
|
51
|
51
|
@Test
|
|
52
|
52
|
public void threeDifferentBooks() {
|
|
53
|
53
|
List<Integer> books = Arrays.asList(1, 2, 3);
|
|
54
|
|
- assertEquals(21.6, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
|
54
|
+ assertEquals(21.60, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
55
|
55
|
}
|
|
56
|
56
|
|
|
57
|
57
|
@Ignore("Remove to run test")
|
|
58
|
58
|
@Test
|
|
59
|
59
|
public void fourDifferentBooks() {
|
|
60
|
60
|
List<Integer> books = Arrays.asList(1, 2, 3, 4);
|
|
61
|
|
- assertEquals(25.6, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
|
61
|
+ assertEquals(25.60, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
62
|
62
|
}
|
|
63
|
63
|
|
|
64
|
64
|
@Ignore("Remove to run test")
|
|
65
|
65
|
@Test
|
|
66
|
66
|
public void fiveDifferentBooks() {
|
|
67
|
67
|
List<Integer> books = Arrays.asList(1, 2, 3, 4, 5);
|
|
68
|
|
- assertEquals(30, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
|
68
|
+ assertEquals(30.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
69
|
69
|
}
|
|
70
|
70
|
|
|
71
|
71
|
@Ignore("Remove to run test")
|
|
|
@@ -79,7 +79,7 @@ public class BookStoreTest {
|
|
79
|
79
|
@Test
|
|
80
|
80
|
public void groupOfFourPlusGroupOfTwoIsCheaperThanTwoGroupsOfThree() {
|
|
81
|
81
|
List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 4);
|
|
82
|
|
- assertEquals(40.8, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
|
82
|
+ assertEquals(40.80, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
83
|
83
|
}
|
|
84
|
84
|
|
|
85
|
85
|
@Ignore("Remove to run test")
|
|
|
@@ -110,4 +110,11 @@ public class BookStoreTest {
|
|
110
|
110
|
assertEquals(75.20, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
111
|
111
|
}
|
|
112
|
112
|
|
|
|
113
|
+ @Ignore("Remove to run test")
|
|
|
114
|
+ @Test
|
|
|
115
|
+ public void fourGroupsOfFourAreCheaperThanTwoGroupsEachOfFiveAndThree() {
|
|
|
116
|
+ List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 5, 1, 1, 2, 2, 3, 3, 4, 5);
|
|
|
117
|
+ assertEquals(102.4, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
|
|
|
118
|
+ }
|
|
|
119
|
+
|
|
113
|
120
|
}
|