diff --git a/Java/src/main/java/com/gildedrose/StorageItem.java b/Java/src/main/java/com/gildedrose/StorageItem.java index 63b567d4..90053764 100644 --- a/Java/src/main/java/com/gildedrose/StorageItem.java +++ b/Java/src/main/java/com/gildedrose/StorageItem.java @@ -9,9 +9,13 @@ public class StorageItem { public static StorageItem createItem(Item item) { if (item.name.equals(AGED_BRIE)) { return new AgeddBrie(item); - } else if (item.name.equals(BACKSTAGE_PASSES)) { + } + if (item.name.equals(BACKSTAGE_PASSES)) { return new BackstagePasses(item); } + if (item.name.equals(SULFURAS)) { + return new Sulfuras(item); + } return new StorageItem(item); } @@ -28,15 +32,10 @@ public class StorageItem { } protected void updateQuality() { - if (item.name.equals(SULFURAS)) { - return; - } else decreaseQuality(); + decreaseQuality(); } protected void updateSelling() { - if (item.name.equals(SULFURAS)) { - return; - } item.sellIn--; } @@ -45,11 +44,7 @@ public class StorageItem { } protected void updateExpired() { - if (item.name.equals(SULFURAS)) { - return; - } else { - decreaseQuality(); - } + decreaseQuality(); } protected void increaseQuality() { diff --git a/Java/src/main/java/com/gildedrose/Sulfuras.java b/Java/src/main/java/com/gildedrose/Sulfuras.java new file mode 100644 index 00000000..f8934fe7 --- /dev/null +++ b/Java/src/main/java/com/gildedrose/Sulfuras.java @@ -0,0 +1,16 @@ +package com.gildedrose; + +public class Sulfuras extends StorageItem { + public Sulfuras(Item item) { + super(item); + } + + @Override + protected void updateQuality() {} + + @Override + protected void updateSelling() {} + + @Override + protected void updateExpired() {} +}