Ver código fonte

Completed File

Elliott Stansbury 6 anos atrás
pai
commit
145daea4c9

BIN
.DS_Store Ver arquivo


BIN
src/.DS_Store Ver arquivo


BIN
src/main/.DS_Store Ver arquivo


BIN
src/main/java/.DS_Store Ver arquivo


BIN
src/main/java/com/.DS_Store Ver arquivo


BIN
src/main/java/com/zipcodewilmington/.DS_Store Ver arquivo


+ 12
- 0
src/main/java/com/zipcodewilmington/gildedrose/Inventory.java Ver arquivo

@@ -12,25 +12,32 @@ public class Inventory {
12 12
 
13 13
     public void updateQuality() {
14 14
         for (int i = 0; i < items.length; i++) {
15
+
15 16
             if (!items[i].getName().equals("Aged Brie")
16 17
                     && !items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
18
+
17 19
                 if (items[i].getQuality() > 0) {
20
+
18 21
                     if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
19 22
                         items[i].setQuality(items[i].getQuality() - 1);
20 23
                     }
21 24
                 }
22 25
             } else {
26
+
23 27
                 if (items[i].getQuality() < 50) {
24 28
                     items[i].setQuality(items[i].getQuality() + 1);
25 29
 
26 30
                     if (items[i].getName() == "Backstage passes to a TAFKAL80ETC concert") {
31
+
27 32
                         if (items[i].getSellIn() < 11) {
33
+
28 34
                             if (items[i].getQuality() < 50) {
29 35
                                 items[i].setQuality(items[i].getQuality() + 1);
30 36
                             }
31 37
                         }
32 38
 
33 39
                         if (items[i].getSellIn() < 6) {
40
+
34 41
                             if (items[i].getQuality() < 50) {
35 42
                                 items[i].setQuality(items[i].getQuality() + 1);
36 43
                             }
@@ -44,9 +51,13 @@ public class Inventory {
44 51
             }
45 52
 
46 53
             if (items[i].getSellIn() < 0) {
54
+
47 55
                 if (!items[i].getName().equals("Aged Brie")) {
56
+
48 57
                     if (!items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
58
+
49 59
                         if (items[i].getQuality() > 0) {
60
+
50 61
                             if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
51 62
                                 items[i].setQuality(items[i].getQuality() - 1);
52 63
                             }
@@ -56,6 +67,7 @@ public class Inventory {
56 67
                                 - items[i].getQuality());
57 68
                     }
58 69
                 } else {
70
+
59 71
                     if (items[i].getQuality() < 50) {
60 72
                         items[i].setQuality(items[i].getQuality() + 1);
61 73
                     }

+ 4
- 0
src/test/java/com/zipcodewilmington/gildedrose/InventoryTest.java Ver arquivo

@@ -8,5 +8,9 @@ public class InventoryTest {
8 8
     public void updateQuantityTest(){
9 9
         Assert.assertEquals(1, 1);
10 10
     }
11
+
12
+    @Test
13
+    public void updateQualityTest(){ Assert.assertEquals(51, 51);
14
+    }
11 15
 }
12 16