Explorar el Código

work in progress

Jacob Andersen hace 6 años
padre
commit
433fe48a87

+ 1
- 1
src/main/java/com/zipcodewilmington/gildedrose/Inventory.java Ver fichero

@@ -68,7 +68,7 @@ public class Inventory {
68 68
                         }
69 69
                     } else
70 70
                         {
71
-                            items[i].setQuality(items[i].getQuality() - items[i].getQuality());
71
+                            items[i].setQuality(0);
72 72
                         }
73 73
                 } else
74 74
                     {

+ 100
- 1
src/test/java/com/zipcodewilmington/gildedrose/InventoryTest.java Ver fichero

@@ -3,10 +3,109 @@ package com.zipcodewilmington.gildedrose;
3 3
 import org.junit.Assert;
4 4
 import org.junit.Test;
5 5
 
6
+
6 7
 public class InventoryTest {
8
+
9
+    Item agedbrietest = new Item("Aged Brie", 7, 4);
10
+    Item backstagepasstest = new Item("Backstage passes to a TAFKAL80ETC concert", 13, 4);
11
+    Item sulfurastest = new Item("Sulfuras, Hand of Ragnaros", 7, 4);
12
+
13
+    Item[] inventoryList =  {agedbrietest,backstagepasstest,sulfurastest};
14
+
15
+    @Test
16
+    public void updateQualityTest() {
17
+        Inventory test = new Inventory(inventoryList);
18
+        test.updateQuality();
19
+
20
+        int expected = agedbrietest.getQuality();
21
+        int actual = 5;
22
+        Assert.assertEquals(expected, actual);
23
+    }
24
+@Test
25
+        public void aged_sellInTest(){
26
+        Inventory test = new Inventory(inventoryList);
27
+
28
+        test.updateQuality();
29
+
30
+        int expected=agedbrietest.getSellIn();
31
+        int actual=6;
32
+        Assert.assertEquals(expected,actual);
33
+    }
34
+    @Test
35
+    public void sulfur_sellInTest() {
36
+        Inventory test = new Inventory(inventoryList);
37
+
38
+        test.updateQuality();
39
+
40
+        int expected = sulfurastest.getSellIn();
41
+        int actual = 7;
42
+        Assert.assertEquals(expected, actual);
43
+    }
44
+
45
+    @Test
46
+    public void backstage_sellInTest(){
47
+        Inventory test = new Inventory(inventoryList);
48
+
49
+        test.updateQuality();
50
+
51
+        int expected=backstagepasstest.getSellIn();
52
+        int actual=12;
53
+        Assert.assertEquals(expected,actual);
54
+    }
55
+    public void setNameTest() {
56
+        sulfurastest.setName("sulphura");
57
+        sulfurastest.getName();
58
+
59
+        String expected = "sulphura";
60
+        String actual = "sulphura";
61
+        Assert.assertEquals(1, 1);
62
+    }
7 63
     @Test
8
-    public void updateQuantityTest(){
64
+    public void getNameTest() {
65
+        agedbrietest.getName();
66
+
67
+        String expected = "Aged Brie";
68
+        String actual = "Aged Brie";
69
+        Assert.assertEquals(1, 1);
70
+    }
71
+
72
+    @Test
73
+    public void getQualityTest() {
74
+
75
+
76
+        agedbrietest.getQuality();
77
+
78
+        int expected = 4;
79
+        int actual = 4;
80
+        Assert.assertEquals(1, 1);
81
+    }
82
+
83
+    @Test
84
+    public void setQualityTest() {
85
+        agedbrietest.setQuality(8);
86
+        agedbrietest.getQuality();
87
+
88
+        int expected = 8;
89
+        int actual = 8;
9 90
         Assert.assertEquals(1, 1);
10 91
     }
92
+
93
+    @Test
94
+    public void getSellinTest() {
95
+        backstagepasstest.getSellIn();
96
+
97
+        int expected = 13;
98
+        int actual = 13;
99
+        Assert.assertEquals(1, 1);
100
+    }
101
+    @Test
102
+    public void setSellInTest(){
103
+        sulfurastest.setSellIn(4);
104
+        sulfurastest.getSellIn();
105
+
106
+        int expected = 4;
107
+        int actual = 4;
108
+        Assert.assertEquals(1, 1);
109
+}
11 110
 }
12 111