-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathBasketTest.java
More file actions
66 lines (42 loc) · 1.33 KB
/
BasketTest.java
File metadata and controls
66 lines (42 loc) · 1.33 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// BasketTest.java
package com.booleanuk.core;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
class BasketTest {
ArrayList<String> baskets;
@Test
public void testAddBagel() {
Basket basket = new Basket();
Assertions.assertTrue(basket.add("bagel1"));
}
@Test
public void testRemoveBagel() {
Basket basket = new Basket();
basket.add("bagel1");
Assertions.assertTrue(basket.remove("bagel1"));
}
@Test
public void testIsFull() {
Basket basket = new Basket();
Assertions.assertTrue(basket.add("bagel1"));
Assertions.assertTrue(basket.add("bagel2"));
Assertions.assertTrue(basket.IsFull());
}
@Test
public void testSetCapacity() {
Basket basket = new Basket();
Assertions.assertTrue(basket.add("bagel1"));
Assertions.assertTrue(basket.add("bagel2"));
Assertions.assertFalse(basket.add("bagel3"));
basket.setCapacity(3);
Assertions.assertTrue(basket.add("bagel3"));
}
@Test
public void removeBagel() {
Basket basket = new Basket();
basket.add("bagel1");
Assertions.assertEquals(1, basket.removeBagel("bagel1"));
Assertions.assertEquals(-1, basket.removeBagel("bagel2"));
}
}