mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 07:51:29 +00:00
🔨 move validateQuality() to GildedRose class
This commit is contained in:
parent
4c7e41537d
commit
53b77f6a8c
@ -22,7 +22,6 @@ public class ItemFactory {
|
||||
if (itemType == null) {
|
||||
itemType = new NormalItem(item);
|
||||
}
|
||||
itemType.validateQuality();
|
||||
return itemType;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.gildedrose.main;
|
||||
|
||||
import com.gildedrose.item_helpers.ItemType;
|
||||
|
||||
import static com.gildedrose.item_helpers.ItemFactory.getItemType;
|
||||
import static java.util.Arrays.stream;
|
||||
|
||||
@ -11,6 +13,10 @@ public class GildedRose {
|
||||
}
|
||||
|
||||
public void updateQuality() {
|
||||
stream(items).forEach(item -> getItemType(item).updateQuality());
|
||||
stream(items).forEach(item -> {
|
||||
ItemType itemType = getItemType(item);
|
||||
itemType.validateQuality();
|
||||
itemType.updateQuality();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user