-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathBasketTest.java
More file actions
50 lines (39 loc) · 1.51 KB
/
BasketTest.java
File metadata and controls
50 lines (39 loc) · 1.51 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
package com.booleanuk.core;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class BasketTest {
Basket basket;
BasketTest(){
basket = new Basket();
}
@Test
public void testAddBagelExists() {
Assertions.assertFalse(basket.addBagel(""));
}
@Test
public void testAddBagel() {
Assertions.assertTrue(basket.addBagel("Cheese Bagel"));
Assertions.assertTrue(basket.addBagel("Cheese Bagel"));
Assertions.assertFalse(basket.addBagel("Ham Bagel"));
Assertions.assertTrue(basket.bagelsInBasket.contains("Cheese Bagel"));
Assertions.assertFalse(basket.bagelsInBasket.contains("Ham Bagel"));
}
@Test
public void testRemoveBagel() {
Assertions.assertFalse(basket.addBagel(""));
Assertions.assertFalse(basket.removeBagel("Double Cheese Bagel")); // doesn't exist
Assertions.assertTrue(basket.removeBagel("Pepperoni Bagel"));
Assertions.assertFalse(basket.removeBagel("Pepperoni Bagel"));// exist
Assertions.assertFalse(basket.bagelsInBasket.contains("Pepperoni Bagel"));
Assertions.assertFalse(basket.bagelsInBasket.contains("Double Cheese Bagel"));
}
@Test
public void testBucketIsNotFull() {
Assertions.assertTrue(basket.addBagel("Cheese Bagel"));
}
@Test
public void testIncrementBucketCapacity() {
Assertions.assertFalse(basket.incrementCapacity(2, "Dave"));
Assertions.assertTrue(basket.incrementCapacity(2, "bob"));
}
}