Unit test shows an example of checking that Honey cake contains gluten, eggs and spice but not red meat, shellfish or poultry.
34 lines
717 B
Java
34 lines
717 B
Java
package net.woodyfolsom.cs6601.p2;
|
|
|
|
import java.util.List;
|
|
|
|
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
|
import com.thoughtworks.xstream.annotations.XStreamImplicit;
|
|
|
|
@XStreamAlias("ing-div")
|
|
public class IngredientDivision {
|
|
@XStreamImplicit
|
|
private List<Ingredient> ingredients;
|
|
private String title;
|
|
|
|
public boolean contains(Ingredient.TYPE ingredientType) {
|
|
for (Ingredient ingredient : ingredients) {
|
|
if (ingredient.isType(ingredientType)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public Ingredient getIngredient(int index) {
|
|
return ingredients.get(index);
|
|
}
|
|
|
|
public int getIngredientsSize() {
|
|
return ingredients.size();
|
|
}
|
|
|
|
public String getTitle() {
|
|
return title;
|
|
}
|
|
}
|