Yesoda Sanka 6 年 前
コミット
8e0e557d51
共有1 個のファイルを変更した51 個の追加1 個の削除を含む
  1. 51
    1
      src/test/java/com/zipcodewilmington/gildedrose/InventoryTest.java

+ 51
- 1
src/test/java/com/zipcodewilmington/gildedrose/InventoryTest.java ファイルの表示

@@ -4,8 +4,45 @@ import org.junit.Assert;
4 4
 import org.junit.Test;
5 5
 
6 6
 public class InventoryTest {
7
+
8
+    Item generictype=new Item ("generic type",7,25);
9
+    Item agebird=new Item ("agebird",7,10);
10
+    Item items[]={generictype ,agebird};
11
+
12
+    Item generic=new Item("generic item",7,25);
13
+
14
+
15
+    @Test
16
+    public void updateQualityTest(){
17
+     Inventory inventory =new Inventory(items);
18
+     int before=items[0].getQuality() ;
19
+     inventory.updateQuality() ;
20
+     int after=items[0].getQuality();
21
+     Assert.assertTrue(before>after) ;
22
+
23
+    }
24
+
25
+    @Test
26
+    public void updateQualityTest1(){
27
+        Inventory inventory =new Inventory(items);
28
+        int before=items[0].getSellIn() ;
29
+        inventory.updateQuality() ;
30
+        int after=items[0].getSellIn() ;
31
+        Assert.assertTrue(before>after) ;
32
+
33
+    }
34
+
35
+    @Test
36
+    public void updateQualityTest2(){
37
+        Inventory inventory =new Inventory(items);
38
+        int before=items[0].getQuality() ;
39
+        inventory.updateQuality() ;
40
+        int after=items[0].getSellIn() ;
41
+        Assert.assertTrue(before>after) ;
42
+
43
+    }
7 44
     @Test
8
-    public void updateQuantity_forAgeBrie(){
45
+    public void updateQuanlity_forAgeBrie(){
9 46
         int sellIn = 5;
10 47
         int quality = 2;
11 48
         Item agedBrie = new Item("Aged Brie", sellIn, quality);
@@ -70,5 +107,18 @@ public class InventoryTest {
70 107
         Assert.assertEquals(expectedQuality, agedBrie.getQuality());
71 108
 
72 109
 }
110
+@Test
111
+    public void updateQuantity_sulfra()
112
+{
113
+    int quantity=80;
114
+    int sellIn=0;
115
+    Item  sulfra=new Item("sulfra" ,sellIn,quantity  ) ;
116
+    Item items[]={sulfra } ;
117
+    Inventory inventory =new Inventory(items);
118
+
119
+
120
+
121
+
122
+}
73 123
 }
74 124