mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 06:21:29 +00:00
Once the sell by date has passed (<=0), Quality degrades twice as fast
This commit is contained in:
parent
91e8ffd57e
commit
d278d9b389
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
# unit tests
|
# unit tests
|
||||||
-[x] At the end of each day our system lowers both values for every item
|
-[x] At the end of each day our system lowers both values for every item
|
||||||
-[ ] Once the sell by date has passed, Quality degrades twice as fast
|
-[x] Once the sell by date has passed, Quality degrades twice as fast
|
||||||
-[ ] The Quality of an item is never negative
|
-[ ] The Quality of an item is never negative
|
||||||
-[ ] "Aged Brie" actually increases in Quality the older it gets
|
-[ ] "Aged Brie" actually increases in Quality the older it gets
|
||||||
-[ ] The Quality of an item is never more than 50
|
-[ ] The Quality of an item is never more than 50
|
||||||
|
|||||||
@ -17,11 +17,28 @@ public class GildedRoseTest {
|
|||||||
//At the end of each day our system lowers both values for every item
|
//At the end of each day our system lowers both values for every item
|
||||||
@Test
|
@Test
|
||||||
public void shouldLowerBothValues(){
|
public void shouldLowerBothValues(){
|
||||||
Item[] items = new Item[] { TestHelper.getItem("foobar", 1, 1) };
|
Item[] items = new Item[] { TestHelper.getItem("foobar", 2, 2) };
|
||||||
GildedRose app = new GildedRose(items);
|
GildedRose app = new GildedRose(items);
|
||||||
app.updateQuality();
|
app.updateQuality();
|
||||||
assertEquals(0, app.items[0].quality);
|
assertEquals(1, app.items[0].quality);
|
||||||
|
assertEquals(1, app.items[0].sellIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Once the sell by date has passed (<=0), Quality degrades twice as fast
|
||||||
|
@Test
|
||||||
|
public void shouldDowngradeTwiceAsFastAfterSellDate(){
|
||||||
|
Item[] items = new Item[] { TestHelper.getItem("foobar", 1, 5) };
|
||||||
|
GildedRose app = new GildedRose(items);
|
||||||
|
|
||||||
|
//day 1, drop by 1
|
||||||
|
app.updateQuality();
|
||||||
|
assertEquals(4, app.items[0].quality);
|
||||||
assertEquals(0, app.items[0].sellIn);
|
assertEquals(0, app.items[0].sellIn);
|
||||||
|
|
||||||
|
//day 2, drop by 2
|
||||||
|
app.updateQuality();
|
||||||
|
assertEquals(2, app.items[0].quality);
|
||||||
|
assertEquals(-1, app.items[0].sellIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user