From 253da0b5bcdcb4e55bccbfc25fc97b0a8a7d51c6 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Mon, 5 Jan 2026 17:20:25 +0100 Subject: [PATCH] chore(test/printExport): delegate creation to DefaultValueFactory --- .../main/java/client/utils/DefaultValueFactory.java | 6 ++++++ .../src/test/java/client/scenes/PrintExportTest.java | 10 +++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/client/src/main/java/client/utils/DefaultValueFactory.java b/client/src/main/java/client/utils/DefaultValueFactory.java index 693c399..7d7f52d 100644 --- a/client/src/main/java/client/utils/DefaultValueFactory.java +++ b/client/src/main/java/client/utils/DefaultValueFactory.java @@ -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"); + } } diff --git a/client/src/test/java/client/scenes/PrintExportTest.java b/client/src/test/java/client/scenes/PrintExportTest.java index e63ab3d..aee0d8d 100644 --- a/client/src/test/java/client/scenes/PrintExportTest.java +++ b/client/src/test/java/client/scenes/PrintExportTest.java @@ -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 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 preparationSteps = new ArrayList<>(); preparationSteps.add("Mix Ingredients");