|
@@ -3,10 +3,108 @@ package com.zipcodewilmington.gildedrose;
|
3
|
3
|
import org.junit.Assert;
|
4
|
4
|
import org.junit.Test;
|
5
|
5
|
|
|
6
|
+import java.util.ArrayList;
|
|
7
|
+
|
6
|
8
|
public class InventoryTest {
|
|
9
|
+
|
|
10
|
+ @Test
|
|
11
|
+ public void testAgedBrie1() {
|
|
12
|
+ Item agedBrie = new Item("Aged Brie", 10, 10);
|
|
13
|
+ Item[] item = {agedBrie};
|
|
14
|
+ Inventory inventory = new Inventory(item);
|
|
15
|
+ inventory.updateQuality();
|
|
16
|
+ int expected = 11;
|
|
17
|
+ int actual = agedBrie.getQuality();
|
|
18
|
+ Assert.assertEquals(expected, actual);
|
|
19
|
+ }
|
|
20
|
+
|
|
21
|
+ @Test
|
|
22
|
+ public void testAgedBrie2() {
|
|
23
|
+ Item agedBrie = new Item("Aged Brie", 10, 49);
|
|
24
|
+ Item[] item = {agedBrie};
|
|
25
|
+ Inventory inventory = new Inventory(item);
|
|
26
|
+ inventory.updateQuality();
|
|
27
|
+ int expected = 50;
|
|
28
|
+ int actual = agedBrie.getQuality();
|
|
29
|
+ Assert.assertEquals(expected, actual);
|
|
30
|
+ }
|
|
31
|
+
|
|
32
|
+ @Test
|
|
33
|
+ public void testAgedBrie3() {
|
|
34
|
+ Item agedBrie = new Item("Aged Brie", 10, 50);
|
|
35
|
+ Item[] item = {agedBrie};
|
|
36
|
+ Inventory inventory = new Inventory(item);
|
|
37
|
+ inventory.updateQuality();
|
|
38
|
+ int expected = 50;
|
|
39
|
+ int actual = agedBrie.getQuality();
|
|
40
|
+ Assert.assertEquals(expected, actual);
|
|
41
|
+ }
|
|
42
|
+
|
|
43
|
+ @Test
|
|
44
|
+ public void testBackstagePass1() {
|
|
45
|
+ Item backstage = new Item("Backstage passes to a TAFKAL80ETC concert", 11, 40);
|
|
46
|
+ Item[] item = {backstage};
|
|
47
|
+ Inventory inventory = new Inventory(item);
|
|
48
|
+ inventory.updateQuality();
|
|
49
|
+ int expected = 41;
|
|
50
|
+ int actual = backstage.getQuality();
|
|
51
|
+ Assert.assertEquals(expected, actual);
|
|
52
|
+ }
|
|
53
|
+
|
7
|
54
|
@Test
|
8
|
|
- public void updateQuantityTest(){
|
9
|
|
- Assert.assertEquals(1, 1);
|
|
55
|
+ public void testBackstagePass2() {
|
|
56
|
+ Item backstage = new Item("Backstage passes to a TAFKAL80ETC concert", 7, 40);
|
|
57
|
+ Item[] item = {backstage};
|
|
58
|
+ Inventory inventory = new Inventory(item);
|
|
59
|
+ inventory.updateQuality();
|
|
60
|
+ int expected = 42;
|
|
61
|
+ int actual = backstage.getQuality();
|
|
62
|
+ Assert.assertEquals(expected, actual);
|
10
|
63
|
}
|
|
64
|
+
|
|
65
|
+ @Test
|
|
66
|
+ public void testBackstagePass3() {
|
|
67
|
+ Item backstage = new Item("Backstage passes to a TAFKAL80ETC concert", 3, 40);
|
|
68
|
+ Item[] item = {backstage};
|
|
69
|
+ Inventory inventory = new Inventory(item);
|
|
70
|
+ inventory.updateQuality();
|
|
71
|
+ int expected = 43;
|
|
72
|
+ int actual = backstage.getQuality();
|
|
73
|
+ Assert.assertEquals(expected, actual);
|
|
74
|
+ }
|
|
75
|
+
|
|
76
|
+ @Test
|
|
77
|
+ public void testBackstagePass4() {
|
|
78
|
+ Item backstage = new Item("Backstage passes to a TAFKAL80ETC concert", 0, 40);
|
|
79
|
+ Item[] item = {backstage};
|
|
80
|
+ Inventory inventory = new Inventory(item);
|
|
81
|
+ inventory.updateQuality();
|
|
82
|
+ int expected = 43;
|
|
83
|
+ int actual = backstage.getQuality();
|
|
84
|
+ Assert.assertEquals(expected, actual);
|
|
85
|
+ }
|
|
86
|
+
|
|
87
|
+ @Test
|
|
88
|
+ public void testBackstagePass5() {
|
|
89
|
+ Item backstage = new Item("Backstage passes to a TAFKAL80ETC concert", -1, 40);
|
|
90
|
+ Item[] item = {backstage};
|
|
91
|
+ Inventory inventory = new Inventory(item);
|
|
92
|
+ inventory.updateQuality();
|
|
93
|
+ int expected = 0;
|
|
94
|
+ int actual = backstage.getQuality();
|
|
95
|
+ Assert.assertEquals(expected, actual);
|
|
96
|
+ }
|
|
97
|
+
|
|
98
|
+ @Test
|
|
99
|
+ public void testSulfurasPass1() {
|
|
100
|
+ Item sulfuras = new Item("Sulfuras, Hand of Ragnaros", 10, 40);
|
|
101
|
+ Item[] item = {sulfuras};
|
|
102
|
+ Inventory inventory = new Inventory(item);
|
|
103
|
+ inventory.updateQuality();
|
|
104
|
+ int expected = 40;
|
|
105
|
+ int actual = sulfuras.getQuality();
|
|
106
|
+ Assert.assertEquals(expected, actual);
|
|
107
|
+ }
|
|
108
|
+
|
11
|
109
|
}
|
12
|
110
|
|