mirror of
https://github.com/UnlegitDqrk/Potato.git
synced 2025-10-02 06:30:15 +02:00
Fixed: Work with new head
This commit is contained in:
@@ -49,9 +49,11 @@ public class Potato implements Tuber {
|
|||||||
*
|
*
|
||||||
* @param names Names of the condiments to add
|
* @param names Names of the condiments to add
|
||||||
*/
|
*/
|
||||||
public void addCondiments(String... names) {
|
public void addCondiments(String... names) throws NotDeliciousException {
|
||||||
for (String condimentName : names) {
|
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 class Condiment {
|
||||||
private final String name;
|
private final String name;
|
||||||
|
private final boolean delicious;
|
||||||
|
|
||||||
public Condiment(String name) {
|
public Condiment(String name, boolean delicious) {
|
||||||
this.name = name;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user