|
@@ -1,12 +1,71 @@
|
1
|
1
|
package com.zipcodewilmington.gildedrose;
|
2
|
2
|
|
3
|
3
|
import org.junit.Assert;
|
|
4
|
+import org.junit.Before;
|
4
|
5
|
import org.junit.Test;
|
5
|
6
|
|
6
|
7
|
public class InventoryTest {
|
|
8
|
+
|
|
9
|
+ Inventory inventory;
|
|
10
|
+ Item agedBrie;
|
|
11
|
+ Item backStagePasses;
|
|
12
|
+ Item sulfuras;
|
|
13
|
+
|
|
14
|
+ @Before
|
|
15
|
+ public void setup(){
|
|
16
|
+ agedBrie = new Item("Aged Brie", 5, 1);
|
|
17
|
+ backStagePasses = new Item("Backstage passes to a TAFKAL80ETC concert", 3, 1);
|
|
18
|
+ sulfuras = new Item("Sulfuras, Hand of Ragnaros", 5, 10);
|
|
19
|
+ Item[] items = {agedBrie, backStagePasses, sulfuras};
|
|
20
|
+ inventory = new Inventory(items);
|
|
21
|
+
|
|
22
|
+ }
|
|
23
|
+
|
|
24
|
+ @Test
|
|
25
|
+ public void updateQualityTest(){
|
|
26
|
+ inventory.updateQuality();
|
|
27
|
+
|
|
28
|
+ int expected = 2;
|
|
29
|
+ int actual = agedBrie.getQuality();
|
|
30
|
+ Assert.assertEquals(expected, actual);
|
|
31
|
+ }
|
|
32
|
+ @Test
|
|
33
|
+ public void agedBrieQualityTest(){
|
|
34
|
+ inventory.updateQuality();
|
|
35
|
+
|
|
36
|
+ int expected = 2;
|
|
37
|
+ int actual = agedBrie.getQuality();
|
|
38
|
+
|
|
39
|
+ Assert.assertEquals(expected, actual);
|
|
40
|
+ }
|
|
41
|
+
|
7
|
42
|
@Test
|
8
|
|
- public void updateQuantityTest(){
|
9
|
|
- Assert.assertEquals(1, 1);
|
|
43
|
+ public void agedBrieSellInTest(){
|
|
44
|
+ inventory.updateQuality();
|
|
45
|
+ //agedBrie.setSellIn(0);
|
|
46
|
+ Assert.assertEquals(2, agedBrie.getQuality());
|
10
|
47
|
}
|
|
48
|
+
|
|
49
|
+ @Test
|
|
50
|
+ public void backStagePassQualityTest() {
|
|
51
|
+ inventory.updateQuality();
|
|
52
|
+ Assert.assertEquals(4, backStagePasses.getQuality());
|
|
53
|
+ }
|
|
54
|
+
|
|
55
|
+ @Test
|
|
56
|
+ public void backStagePass5Test(){
|
|
57
|
+ inventory.updateQuality();
|
|
58
|
+
|
|
59
|
+ Assert.assertEquals(4, backStagePasses.getQuality());
|
|
60
|
+
|
|
61
|
+ }
|
|
62
|
+
|
|
63
|
+ @Test
|
|
64
|
+ public void backStagePass10Test() {
|
|
65
|
+ inventory.updateQuality();
|
|
66
|
+
|
|
67
|
+ Assert.assertEquals(4, backStagePasses.getQuality());
|
|
68
|
+ }
|
|
69
|
+
|
11
|
70
|
}
|
12
|
71
|
|