Extract sellIn decrease into private method

This commit is contained in:
Bjorn Misseghers 2021-04-06 20:22:31 +02:00
parent 2fb5d2bc77
commit f040a5d3fb

View File

@ -44,7 +44,7 @@ class GildedRose {
} }
if (!currentItem.name.equals(ITEM_SULFURAS_HAND_OF_RAGNAROS)) { if (!currentItem.name.equals(ITEM_SULFURAS_HAND_OF_RAGNAROS)) {
currentItem.sellIn = currentItem.sellIn - 1; decreaseSellIn(currentItem);
} }
if (currentItem.sellIn < 0) { if (currentItem.sellIn < 0) {
@ -74,4 +74,8 @@ class GildedRose {
private void increaseQuality(Item item) { private void increaseQuality(Item item) {
item.quality = item.quality + 1; item.quality = item.quality + 1;
} }
private void decreaseSellIn(Item item) {
item.sellIn = item.sellIn - 1;
}
} }