diff options
| author | Kyle Clemens <jkc.clemens@gmail.com> | 2015-10-01 17:38:35 -0400 |
|---|---|---|
| committer | Kyle Clemens <jkc.clemens@gmail.com> | 2015-10-01 17:38:35 -0400 |
| commit | 074f15a5a63701875f9f6b5990ec1ce4cc880428 (patch) | |
| tree | f4dd19ce7c345da5cf2bb4561dfb424da5a7a476 /src | |
| parent | 0c30963c23151f60ce8a2e471faaeeb61687993c (diff) | |
| parent | 6a6da383a9ce8fda543f9bb7d32bb91f12ad861a (diff) | |
Fixed: Work with new head
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/java/org/drtshock/Potato.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/main/java/org/drtshock/Potato.java b/src/main/java/org/drtshock/Potato.java index 7ec23ac..120f88b 100644 --- a/src/main/java/org/drtshock/Potato.java +++ b/src/main/java/org/drtshock/Potato.java @@ -49,9 +49,11 @@ public class Potato implements Tuber { * * @param names Names of the condiments to add */ - public void addCondiments(String... names) { + public void addCondiments(String... names) throws NotDeliciousException { for (String condimentName : names) { - this.getCondiments().add(new Condiment(condimentName)); + Condiment condiment = new Condiment(condimentName, true); + if (!condiment.isDelicious()) throw new NotDeliciousException(); + this.getCondiments().add(condiment); } } @@ -119,9 +121,20 @@ public class Potato implements Tuber { */ private class Condiment { private final String name; + private final boolean delicious; - public Condiment(String name) { + public Condiment(String name, boolean delicious) { this.name = name; + this.delicious = delicious; + } + + /** + * Returns if this condiment is delicious or not. + * + * @return true if delicious, false if otherwise + */ + public boolean isDelicious() { + return this.delicious; } /** |
