|
|
@@ -8,14 +8,17 @@ public class InventoryTest {
|
|
8
|
8
|
private static final String AGED_BRIE_NAME = "Aged Brie";
|
|
9
|
9
|
private static final String BACKSTAGE_PASS_NAME = "Backstage passes to a TAFKAL80ETC concert";
|
|
10
|
10
|
private static final String NORMAL_ITEM_NAME = "+5 Dexterity Vest";
|
|
|
11
|
+ private static final String CONJURED_ITEM_NAME = "Conjured Item: Thori'dal, the Stars' Fury";
|
|
11
|
12
|
|
|
12
|
13
|
private Item sulfuras;
|
|
13
|
14
|
private Item normalItem;
|
|
|
15
|
+ private Item conjuredItem;
|
|
14
|
16
|
|
|
15
|
17
|
@Before
|
|
16
|
18
|
public void setup(){
|
|
17
|
19
|
sulfuras = new Item("Sulfuras, Hand of Ragnaros", 0, 80);
|
|
18
|
20
|
normalItem = new Item(NORMAL_ITEM_NAME, 10, 20);
|
|
|
21
|
+ conjuredItem = new Item(CONJURED_ITEM_NAME, 10, 20);
|
|
19
|
22
|
}
|
|
20
|
23
|
|
|
21
|
24
|
@Test
|
|
|
@@ -49,7 +52,7 @@ public class InventoryTest {
|
|
49
|
52
|
|
|
50
|
53
|
assertEquals(expectedSellIn, normalItem.getSellIn());
|
|
51
|
54
|
}
|
|
52
|
|
-
|
|
|
55
|
+
|
|
53
|
56
|
@Test
|
|
54
|
57
|
public void testUpdate_ForNormalItemQuantity() throws Exception {
|
|
55
|
58
|
int expectedQuality = normalItem.getQuality() - 1;
|
|
|
@@ -60,6 +63,17 @@ public class InventoryTest {
|
|
60
|
63
|
|
|
61
|
64
|
assertEquals(expectedQuality, normalItem.getQuality());
|
|
62
|
65
|
}
|
|
|
66
|
+
|
|
|
67
|
+ @Test
|
|
|
68
|
+ public void testUpdate_ForConjuredItemQuantity() throws Exception {
|
|
|
69
|
+ int expectedQuality = conjuredItem.getQuality() - 2;
|
|
|
70
|
+ Item[] items = {conjuredItem};
|
|
|
71
|
+ Inventory sut = new Inventory(items);
|
|
|
72
|
+
|
|
|
73
|
+ sut.updateQuality();
|
|
|
74
|
+
|
|
|
75
|
+ assertEquals(expectedQuality, conjuredItem.getQuality());
|
|
|
76
|
+ }
|
|
63
|
77
|
|
|
64
|
78
|
@Test
|
|
65
|
79
|
public void testUpdate_ForSoldOutItem() throws Exception {
|
|
|
@@ -84,6 +98,18 @@ public class InventoryTest {
|
|
84
|
98
|
|
|
85
|
99
|
assertEquals(expectedQuality, normalItemWithPassedSellDate.getQuality());
|
|
86
|
100
|
}
|
|
|
101
|
+
|
|
|
102
|
+ @Test
|
|
|
103
|
+ public void testUpdate_ForConjuredItemOnceTheSellInDatePassed() throws Exception {
|
|
|
104
|
+ Item conjuredItemWithPassedSellDate = new Item(CONJURED_ITEM_NAME, -1, 25);
|
|
|
105
|
+ int expectedQuality = conjuredItemWithPassedSellDate.getQuality() - 4;
|
|
|
106
|
+ Item[] items = {conjuredItemWithPassedSellDate};
|
|
|
107
|
+ Inventory sut = new Inventory(items);
|
|
|
108
|
+
|
|
|
109
|
+ sut.updateQuality();
|
|
|
110
|
+
|
|
|
111
|
+ assertEquals(expectedQuality, conjuredItemWithPassedSellDate.getQuality());
|
|
|
112
|
+ }
|
|
87
|
113
|
|
|
88
|
114
|
@Test
|
|
89
|
115
|
public void testUpdate_AgedBrie() throws Exception {
|