mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-04 09:11:39 +00:00
feature: add Unknown type
This commit is contained in:
parent
981180fdb0
commit
8879189e92
@ -5,7 +5,8 @@ import java.util.Arrays;
|
||||
public enum ItemType {
|
||||
AgedBrie("Aged Brie"),
|
||||
BackstagePass("Backstage passes to a TAFKAL80ETC concert"),
|
||||
Sulfuras("Sulfuras, Hand of Ragnaros");
|
||||
Sulfuras("Sulfuras, Hand of Ragnaros"),
|
||||
Unknown("Unknown");
|
||||
|
||||
private final String name;
|
||||
|
||||
@ -21,6 +22,6 @@ public enum ItemType {
|
||||
return Arrays.stream(ItemType.values())
|
||||
.filter(itemType -> itemType.getName().equals(name))
|
||||
.findFirst()
|
||||
.orElseThrow( () -> new IllegalArgumentException(name));
|
||||
.orElse(Unknown);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user