Ingredient Constructors for testing

This commit is contained in:
Oskar Rasieński 2026-01-14 19:06:09 +01:00
commit 9008bdd026
3 changed files with 20 additions and 3 deletions

View file

@ -31,6 +31,13 @@ public class FormalIngredient extends RecipeIngredient implements Scalable<Forma
this.unitSuffix = unitSuffix;
}
public FormalIngredient(Long id, Ingredient ingredient, double amount, String unitSuffix) {
// For testing
super(id, ingredient);
this.amount = amount;
this.unitSuffix = unitSuffix;
}
public FormalIngredient(Ingredient ingredient, double amount, String unitSuffix) {
super(ingredient);
this.amount = amount;

View file

@ -54,9 +54,14 @@ public abstract class RecipeIngredient {
// for ORM
}
public RecipeIngredient(
Ingredient ingredient) {
//store it in the field
public RecipeIngredient(Ingredient ingredient) {
// Store it in the field
this.ingredient = ingredient;
}
public RecipeIngredient(Long id, Ingredient ingredient) {
// For testing
this.id = id;
this.ingredient = ingredient;
}

View file

@ -24,6 +24,11 @@ public class VagueIngredient extends RecipeIngredient {
this.description = description;
}
public VagueIngredient(Long id, Ingredient ingredient, String description) {
super(id, ingredient);
this.description = description;
}
public VagueIngredient(Ingredient ingredient, String description) {
super(ingredient);
this.description = description;