Pārlūkot izejas kodu

Delete 'InventoryTest.java'

woat 6 gadus atpakaļ
vecāks
revīzija
115b9ddf0a
1 mainītis faili ar 0 papildinājumiem un 122 dzēšanām
  1. 0
    122
      InventoryTest.java

+ 0
- 122
InventoryTest.java Parādīt failu

@@ -1,122 +0,0 @@
1
-import static org.junit.Assert.*;
2
-import java.util.Arrays;
3
-import org.junit.Test;
4
-import org.junit.Before;
5
-
6
-public class InventoryTest {
7
-    private static final int MAX_QUALITY = 50;
8
-    private static final String AGED_BRIE_NAME = "Aged Brie";
9
-    private static final String BACKSTAGE_PASS_NAME = "Backstage passes to a TAFKAL80ETC concert";
10
-    private static final String NORMAL_ITEM_NAME = "+5 Dexterity Vest";
11
-
12
-    private Item sulfuras;
13
-    private Item normalItem;
14
-
15
-    @Before
16
-    public void setup(){
17
-        sulfuras = new Item("Sulfuras, Hand of Ragnaros", 0, 80);
18
-        normalItem = new Item(NORMAL_ITEM_NAME, 10, 20);
19
-    }
20
-
21
-    @Test
22
-    public void testUpdate_ForSulfurasQuality() throws Exception {
23
-        int expectedQuality = sulfuras.getQuality();
24
-        Item[] items = {sulfuras};
25
-        Inventory sut = new Inventory(items);
26
-
27
-        sut.updateQuality();
28
-
29
-        assertEquals(expectedQuality, sulfuras.getQuality());
30
-    }
31
-    @Test
32
-    public void testUpdate_ForSulfurasSellIn() throws Exception {
33
-        int expectedSellIn = sulfuras.getSellIn();
34
-        Item[] items = {sulfuras};
35
-        Inventory sut = new Inventory(items);
36
-
37
-        sut.updateQuality();
38
-
39
-        assertEquals(expectedSellIn, sulfuras.getSellIn());
40
-    }
41
-
42
-    @Test
43
-    public void testUpdate_ForNormalItemSellIn() throws Exception {
44
-        int expectedSellIn = normalItem.getSellIn() - 1;
45
-        Item[] items = {normalItem};
46
-        Inventory sut = new Inventory(items);
47
-
48
-        sut.updateQuality();
49
-
50
-        assertEquals(expectedSellIn, normalItem.getSellIn());
51
-    }
52
-
53
-    @Test
54
-    public void testUpdate_ForNormalItemQuantity() throws Exception {
55
-        int expectedQuality = normalItem.getQuality() - 1;
56
-        Item[] items = {normalItem};
57
-        Inventory sut = new Inventory(items);
58
-
59
-        sut.updateQuality();
60
-
61
-        assertEquals(expectedQuality, normalItem.getQuality());
62
-    }
63
-
64
-    @Test
65
-    public void testUpdate_ForSoldOutItem() throws Exception {
66
-        int minimumQuality = 0;
67
-        Item normalItemWithMinimumQuality = new Item(NORMAL_ITEM_NAME, 10, minimumQuality);
68
-        Item[] items = {normalItemWithMinimumQuality};
69
-        Inventory sut = new Inventory(items);
70
-
71
-        sut.updateQuality();
72
-
73
-        assertEquals(minimumQuality, normalItemWithMinimumQuality.getQuality());
74
-    }
75
-
76
-    @Test
77
-    public void testUpdate_ForNormalItemOnceTheSellInDatePassed() throws Exception {
78
-        Item normalItemWithPassedSellDate = new Item(NORMAL_ITEM_NAME, -1, 25);
79
-        int expectedQuality = normalItemWithPassedSellDate.getQuality() - 2;
80
-        Item[] items = {normalItemWithPassedSellDate};
81
-        Inventory sut = new Inventory(items);
82
-
83
-        sut.updateQuality();
84
-
85
-        assertEquals(expectedQuality, normalItemWithPassedSellDate.getQuality());
86
-    }
87
-
88
-    @Test
89
-    public void testUpdate_AgedBrie() throws Exception {
90
-        Item agedBrie = new Item(AGED_BRIE_NAME, 10, 25);
91
-        int expectedQuality = agedBrie.getQuality() + 1;
92
-        Item[] items = {agedBrie};
93
-        Inventory sut = new Inventory(items);
94
-
95
-        sut.updateQuality();
96
-
97
-        assertEquals(expectedQuality, agedBrie.getQuality());
98
-    }
99
-
100
-    @Test
101
-    public void testUpdate_WhenAgedBrieIsAtMaxQuality() throws Exception {
102
-        Item agedBrie = new Item(AGED_BRIE_NAME, 10, MAX_QUALITY);
103
-        Item[] items = {agedBrie};
104
-        Inventory sut = new Inventory(items);
105
-
106
-        sut.updateQuality();
107
-
108
-        assertEquals(MAX_QUALITY, agedBrie.getQuality());
109
-    }
110
-
111
-    @Test
112
-    public void testUpdate_WhenAgedBrieOnceTheSellInDatePassed() throws Exception {
113
-        Item agedBrie = new Item(AGED_BRIE_NAME, -1, 20);
114
-        int expectedQuality = agedBrie.getQuality() + 2;
115
-        Item[] items = {agedBrie};
116
-        Inventory sut = new Inventory(items);
117
-
118
-        sut.updateQuality();
119
-
120
-        assertEquals(expectedQuality, agedBrie.getQuality());
121
-    }
122
-}