/** Test of updateConjured method, of class GildedRose. */ @Test public void testUpdateConjured() { System.out.println("updateConjured"); Item item = new Item("Conjured Mana Cake", 3, 6); Item expResult = new Item("Conjured Mana Cake", 2, 4); Item result = GildedRose.updateConjured(item); assertEquals(expResult.getQuality(), result.getQuality()); assertEquals(expResult.getSellIn(), result.getSellIn()); }
@Override public void detallesDelProduto(Item item) { // TODO Auto-generated method stub AumentarCualidadMenor50.dismiuirCualidad(item); item.setSellIn(item.getSellIn() - 1); if (item.getQuality() < 50 && item.getSellIn() < 0) { item.setQuality(item.getQuality() + 1); } }
@Override public void updateItem(Item item) { // TODO Auto-generated method stub flag = new QualityFlags(item); updateSellIn(item); if (flag.AboveMinimum() && flag.SellInBelowMinimum()) item.setQuality(item.getQuality() - 4); else if (flag.AboveMinimum()) item.setQuality(item.getQuality() - 2); }
/** Test of updateSulfuras method, of class GildedRose. */ @Test public void testUpdateSulfuras() { System.out.println("updateSulfuras"); Item item = new Item("Sulfuras, Hand of Ragnaros", 0, 80); Item expResult = new Item("Sulfuras, Hand of Ragnaros", 0, 80); Item result = GildedRose.updateSulfuras(item); assertEquals(expResult.getQuality(), result.getQuality()); assertEquals(expResult.getSellIn(), result.getSellIn()); }
/** Test of updateBackstage method, of class GildedRose. */ @Test public void testUpdateBackstage() { System.out.println("updateBackstage"); Item item = new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20); Item expResult = new Item("Backstage passes to a TAFKAL80ETC concert", 14, 21); Item result = GildedRose.updateBackstage(item); assertEquals(expResult.getQuality(), result.getQuality()); assertEquals(expResult.getSellIn(), result.getSellIn()); Item item1 = new Item("Backstage passes to a TAFKAL80ETC concert", 1, 4); Item expResult1 = new Item("Backstage passes to a TAFKAL80ETC concert", 0, 7); Item result1 = GildedRose.updateBackstage(item1); assertEquals(expResult1.getQuality(), result1.getQuality()); assertEquals(expResult1.getSellIn(), result1.getSellIn()); }
/** Test of updateAgedBrie method, of class GildedRose. */ @Test public void testUpdateAgedBrie() { System.out.println("updateAgedBrie"); Item item = new Item("Aged Brie", 2, 0); Item expResult = new Item("Aged Brie", 1, 1); Item result = GildedRose.updateAgedBrie(item); assertEquals(expResult.getQuality(), result.getQuality()); assertEquals(expResult.getSellIn(), result.getSellIn()); Item item1 = new Item("Aged Brie", 1, 1); Item expResult1 = new Item("Aged Brie", 0, 2); Item result1 = GildedRose.updateAgedBrie(item); assertEquals(expResult1.getQuality(), result1.getQuality()); assertEquals(expResult1.getSellIn(), result1.getSellIn()); }
/** Test of updateDefault method, of class GildedRose. */ @Test public void testUpdateDefault() { System.out.println("updateDefault"); Item item = new Item("+5 Dexterity Vest", 10, 20); Item expResult = new Item("+5 Dexterity Vest", 9, 19); Item result = GildedRose.updateDefault(item); assertEquals(expResult.getQuality(), result.getQuality()); assertEquals(expResult.getSellIn(), result.getSellIn()); Item item1 = new Item("+5 Dexterity Vest", 0, 20); Item expResult1 = new Item("+5 Dexterity Vest", 0, 0); Item result1 = GildedRose.updateDefault(item1); assertEquals(expResult1.getQuality(), result1.getQuality()); assertEquals(expResult1.getSellIn(), result1.getSellIn()); }
@Override public void detallesDelProduto(Item item) { // TODO Auto-generated method stub AumentarCualidadMenor50.dismiuirCualidad(item); if (item.getSellIn() < 0) { if (item.getQuality() > 0 && item.getQuality() != 80) { item.setQuality(item.getQuality() - 1); } if (item.getQuality() > 0 && item.getQuality() != 80 && item.getName().equals("Conjured Mana Cake") && item.getQuality() > 0) { item.setQuality(item.getQuality() - 1); } } }
@Test public void testQualitySuperiorToFifthySellinAndQualityUpdate() { GildedRose.updateItem(AGED_BRIE_2); assertEquals(AGED_BRIE_2.getSellIn(), 9); assertEquals(AGED_BRIE_2.getQuality(), 50); }
@Test public void testAgedBrieSellinAndQualityUpdate() { GildedRose.updateItem(AGED_BRIE); assertEquals(AGED_BRIE.getSellIn(), 1); assertEquals(AGED_BRIE.getQuality(), 1); }
@Test public void testQualityInferiorToZeroSellinAndQualityUpdate() { GildedRose.updateItem(THIRD_ITEM); assertEquals(THIRD_ITEM.getSellIn(), 9); assertEquals(THIRD_ITEM.getQuality(), 0); }
@Test public void testSellInInferiorToZeroSellinAndQualityUpdate() { GildedRose.updateItem(SECOND_ITEM); assertEquals(SECOND_ITEM.getSellIn(), -1); assertEquals(SECOND_ITEM.getQuality(), 18); }
@Test public void testNoConditionSellinAndQualityDecrease() { GildedRose.updateItem(FIRST_ITEM); assertEquals(FIRST_ITEM.getSellIn(), 9); assertEquals(FIRST_ITEM.getQuality(), 19); }