chore(test/printExport): delegate creation to DefaultValueFactory

This commit is contained in:
Zhongheng Liu 2026-01-05 17:20:25 +01:00
commit 253da0b5bc
2 changed files with 9 additions and 7 deletions

View file

@ -54,4 +54,10 @@ public class DefaultValueFactory {
defaultIngredient,
"Some");
}
public static VagueIngredient getDefaultVagueIngredient(String name) {
return new VagueIngredient(
new Ingredient(name, 0., 0., 0.),
"Some");
}
}

View file

@ -1,11 +1,10 @@
package client.scenes;
import client.utils.DefaultValueFactory;
import client.utils.PrintExportService;
import client.utils.ServerUtils;
import commons.Ingredient;
import commons.Recipe;
import commons.RecipeIngredient;
import commons.VagueIngredient;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -21,9 +20,6 @@ import static org.junit.jupiter.api.Assertions.*;
public class PrintExportTest {
static ServerUtils dv = new ServerUtils();
private VagueIngredient getVague(String name) {
return new VagueIngredient(new Ingredient(name, 0., 0., 0.), "some");
}
@BeforeEach
public void setup(){
Assumptions.assumeTrue(dv.isServerAvailable(), "Server not available");
@ -32,8 +28,8 @@ public class PrintExportTest {
@Test
public void buildRecipeTextTest(){
List<RecipeIngredient> ingredients = new ArrayList<>();
ingredients.add(getVague("Banana"));
ingredients.add(getVague("Bread"));
ingredients.add(DefaultValueFactory.getDefaultVagueIngredient("Banana"));
ingredients.add(DefaultValueFactory.getDefaultVagueIngredient("Bread"));
final long testRecipeId = 1234L;
List<String> preparationSteps = new ArrayList<>();
preparationSteps.add("Mix Ingredients");