mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
Backstage passes unit test
This commit is contained in:
parent
6731e834ef
commit
6147b678a3
@ -16,8 +16,8 @@
|
|||||||
-[x] The Quality of an item is never more than 50
|
-[x] The Quality of an item is never more than 50
|
||||||
-[x] "Sulfuras", being a legendary item, never has to be sold or decreases in Quality
|
-[x] "Sulfuras", being a legendary item, never has to be sold or decreases in Quality
|
||||||
-[x] "Backstage passes", like aged brie, increases in Quality as its SellIn value approaches;
|
-[x] "Backstage passes", like aged brie, increases in Quality as its SellIn value approaches;
|
||||||
-[ ] Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but
|
-[x] Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but
|
||||||
-[ ] Quality drops to 0 after the concert
|
-[x] Quality drops to 0 after the concert
|
||||||
-[ ] an item can never have its Quality increase above 50, however "Sulfuras" is a legendary item and as such its Quality is 80 and it never alters.
|
-[ ] an item can never have its Quality increase above 50, however "Sulfuras" is a legendary item and as such its Quality is 80 and it never alters.
|
||||||
|
|
||||||
## Technical Issues, with a balanced priority
|
## Technical Issues, with a balanced priority
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.gildedrose;
|
|||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Nested;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class GildedRoseTest {
|
public class GildedRoseTest {
|
||||||
@ -108,7 +109,7 @@ public class GildedRoseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("\"Backstage passes\", like aged brie, increases in Quality as its SellIn value approaches")
|
@DisplayName("\"Backstage passes\", like aged brie, increases in Quality as its SellIn value approaches")
|
||||||
public void shouldDo(){
|
public void shouldIncreaseQualityForBrieWhenSellInReduces() {
|
||||||
Item[] items = new Item[]{TestHelper.getItem("Backstage passes to a TAFKAL80ETC concert", 5, 10)};
|
Item[] items = new Item[]{TestHelper.getItem("Backstage passes to a TAFKAL80ETC concert", 5, 10)};
|
||||||
GildedRose app = new GildedRose(items);
|
GildedRose app = new GildedRose(items);
|
||||||
|
|
||||||
@ -123,4 +124,40 @@ public class GildedRoseTest {
|
|||||||
assertEquals(3, app.items[0].sellIn);
|
assertEquals(3, app.items[0].sellIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@DisplayName("Backstage passes")
|
||||||
|
class BaskstagePasses{
|
||||||
|
@Test
|
||||||
|
@DisplayName("Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but")
|
||||||
|
public void shouldIncreaseQualityBasedOnSellIn() {
|
||||||
|
Item[] items = new Item[]{
|
||||||
|
TestHelper.getItem("Backstage passes to a TAFKAL80ETC concert", 10, 10),
|
||||||
|
TestHelper.getItem("Backstage passes to a TAFKAL80ETC concert", 5, 10)
|
||||||
|
};
|
||||||
|
GildedRose app = new GildedRose(items);
|
||||||
|
|
||||||
|
app.updateQuality();
|
||||||
|
assertEquals(12, app.items[0].quality);
|
||||||
|
assertEquals(9, app.items[0].sellIn);
|
||||||
|
|
||||||
|
assertEquals(13, app.items[1].quality);
|
||||||
|
assertEquals(4, app.items[1].sellIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Quality drops to 0 after the concert")
|
||||||
|
public void shouldHaveQualityDroppingToZeroAfterConcert(){
|
||||||
|
Item[] items = new Item[]{
|
||||||
|
TestHelper.getItem("Backstage passes to a TAFKAL80ETC concert", 0, 10)
|
||||||
|
};
|
||||||
|
|
||||||
|
GildedRose app = new GildedRose(items);
|
||||||
|
|
||||||
|
app.updateQuality();
|
||||||
|
assertEquals(0, app.items[0].quality);
|
||||||
|
assertEquals(-1, app.items[0].sellIn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user