-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathBasketTest.java
More file actions
38 lines (32 loc) · 1010 Bytes
/
BasketTest.java
File metadata and controls
38 lines (32 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.booleanuk.core;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class BasketTest {
@Test
public void addItemThatDoesNotExist() {
Basket basket = new Basket();
Assertions.assertTrue(basket.add("milk", 2));
}
@Test
public void addItemThatAlreadyExists() {
Basket basket = new Basket();
basket.items.put("butter", 4);
Assertions.assertFalse(basket.add("butter", 4));
}
@Test
public void getCorrectTotalCost() {
Basket basket = new Basket();
basket.items.put("butter", 4);
basket.items.put("milk", 2);
basket.items.put("coffee", 7);
Assertions.assertEquals(13, basket.total());
}
@Test
public void getWrongTotalCost() {
Basket basket = new Basket();
basket.items.put("butter", 4);
basket.items.put("milk", 2);
basket.items.put("coffee", 7);
Assertions.assertNotEquals(10, basket.total());
}
}