Soujanya Buragapu il y a 6 ans
Parent
révision
683c556a5a

+ 59
- 0
src/test/java/com/zipcodewilmington/gildedrose/InventoryTest.java Voir le fichier

@@ -10,5 +10,64 @@ public class InventoryTest
10 10
     {
11 11
         Assert.assertEquals(1, 1);
12 12
     }
13
+
14
+    @Test
15
+    public void updateQuantity_forAgeBrie(){
16
+        int sellIn = 5;
17
+        int quality = 2;
18
+        Item agedBrie = new Item("Aged Brie", sellIn, quality);
19
+
20
+        Item[] items = {agedBrie};
21
+        Inventory inventory = new Inventory(items);
22
+
23
+        inventory.updateQuality();
24
+
25
+        int expectedQuality = quality;
26
+        Assert.assertEquals(expectedQuality, agedBrie.getQuality());
27
+    }
28
+
29
+    @Test
30
+    public void updateQuantity_forAgeBrieWhenQualityIs50(){
31
+        int sellIn = 5;
32
+        int quality = 50;
33
+        Item agedBrie = new Item("Aged Brie", sellIn, quality);
34
+
35
+        Item[] items = {agedBrie};
36
+        Inventory inventory = new Inventory(items);
37
+
38
+        inventory.updateQuality();
39
+
40
+        int expectedQuality = quality;
41
+        Assert.assertEquals(expectedQuality, agedBrie.getQuality());
42
+    }
43
+    @Test
44
+    public void updateQuantity_forAgeBrieWhenQualityIs49(){
45
+        int sellIn = 5;
46
+        int quality = 30;
47
+        Item agedBrie = new Item("Aged Brie", sellIn, quality);
48
+
49
+        Item[] items = {agedBrie};
50
+        Inventory inventory = new Inventory(items);
51
+
52
+        inventory.updateQuality();
53
+
54
+        int expectedQuality = quality;
55
+        Assert.assertEquals(expectedQuality, agedBrie.getQuality());
56
+    }
57
+    @Test
58
+    public void updateQuantity_forBackstagepasses(){
59
+        int sellIn = 5;
60
+        int quality = 10;
61
+        Item agedBrie = new Item("Backstage passes", sellIn, quality);
62
+
63
+        Item[] items = {agedBrie};
64
+        Inventory inventory = new Inventory(items);
65
+
66
+        inventory.updateQuality();
67
+
68
+        int expectedQuality = quality;
69
+        Assert.assertEquals(expectedQuality, agedBrie.getQuality());
70
+
71
+    }
13 72
 }
14 73