Browse Source

Conjured added with tests.

Lauren Green 6 years ago
parent
commit
f67694efdc

+ 2
- 2
src/main/java/com/zipcodewilmington/gildedrose/Inventory.java View File

@@ -54,9 +54,9 @@ public class Inventory {
54 54
                 increaseQualityByOne(i);
55 55
             } else if (items[i].getName().equals("Backstage Passes") && (items[i].getSellIn() <= 10)) {
56 56
                 increaseQualityByTwo(i);
57
-                if ((items[i].getSellIn() <= 10)) {
57
+                if ((items[i].getSellIn() <= 5)) {
58 58
                 increaseQualityByOne(i);
59
-            } } else if (items[i].getSellIn() == 0) {
59
+            } } else if ((items[i].getName().equals("Conjured")) || (items[i].getSellIn() == 0)) {
60 60
                 decreaseQualityByTwo(i);
61 61
             } else {
62 62
                 decreaseQualityByOne(i);

+ 18
- 0
src/test/java/com/zipcodewilmington/gildedrose/InventoryTest.java View File

@@ -244,6 +244,24 @@ public class InventoryTest {
244 244
         Assert.assertEquals(expected, actual);
245 245
     }
246 246
 
247
+    @Test
248
+    public void ConjuredQualityTest(){
249
+        //Given
250
+        Item conjured = new Item("Conjured", 10, 20);
251
+        Item[] itemArr = new Item[1];
252
+        itemArr[0] = conjured;
253
+        Inventory newInv = new Inventory(itemArr);
254
+        int expected = 18;
255
+
256
+        //When
257
+        newInv.updateSellIn();
258
+        newInv.updateQuality();
259
+
260
+        //Then
261
+        int actual = conjured.getQuality();
262
+
263
+        Assert.assertEquals(expected, actual);
264
+    }
247 265
 }
248 266
 
249 267
 /*