|
|
@@ -8,7 +8,8 @@ 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
|
|
-
|
|
|
11
|
+ private static final String CONJURED_SWORD_NAME = "Conjured Sword";
|
|
|
12
|
+
|
|
12
|
13
|
private Item sulfuras;
|
|
13
|
14
|
private Item normalItem;
|
|
14
|
15
|
|
|
|
@@ -119,4 +120,39 @@ public class InventoryTest {
|
|
119
|
120
|
|
|
120
|
121
|
assertEquals(expectedQuality, agedBrie.getQuality());
|
|
121
|
122
|
}
|
|
|
123
|
+
|
|
|
124
|
+ @Test
|
|
|
125
|
+ public void testUpdate_ConjuredSword() throws Exception {
|
|
|
126
|
+ Item conjuredSword = new Item(CONJURED_SWORD_NAME, 10, 25);
|
|
|
127
|
+ int expectedQuality = conjuredSword.getQuality() - 2;
|
|
|
128
|
+ Item[] items = {conjuredSword};
|
|
|
129
|
+ Inventory sut = new Inventory(items);
|
|
|
130
|
+
|
|
|
131
|
+ sut.updateQuality();
|
|
|
132
|
+
|
|
|
133
|
+ assertEquals(expectedQuality, conjuredSword.getQuality());
|
|
|
134
|
+ }
|
|
|
135
|
+
|
|
|
136
|
+ @Test
|
|
|
137
|
+ public void testUpdate_ConjuredSwordIsAtMaxQuality() throws Exception {
|
|
|
138
|
+ Item conjuredSword = new Item(CONJURED_SWORD_NAME, 10, MAX_QUALITY);
|
|
|
139
|
+ Item[] items = {conjuredSword};
|
|
|
140
|
+ Inventory sut = new Inventory(items);
|
|
|
141
|
+
|
|
|
142
|
+ sut.updateQuality();
|
|
|
143
|
+
|
|
|
144
|
+ assertEquals((MAX_QUALITY-2), conjuredSword.getQuality());
|
|
|
145
|
+ }
|
|
|
146
|
+
|
|
|
147
|
+ @Test
|
|
|
148
|
+ public void testUpdate_WhenConjuredSwordOnceTheSellInDatePassed() throws Exception {
|
|
|
149
|
+ Item conjuredSword = new Item(CONJURED_SWORD_NAME, -1, 20);
|
|
|
150
|
+ int expectedQuality = conjuredSword.getQuality() - 4;
|
|
|
151
|
+ Item[] items = {conjuredSword};
|
|
|
152
|
+ Inventory sut = new Inventory(items);
|
|
|
153
|
+
|
|
|
154
|
+ sut.updateQuality();
|
|
|
155
|
+
|
|
|
156
|
+ assertEquals(expectedQuality, conjuredSword.getQuality());
|
|
|
157
|
+ }
|
|
122
|
158
|
}
|