diff --git a/server/src/test/java/server/api/RecipeControllerTest.java b/server/src/test/java/server/api/RecipeControllerTest.java index 9b27d2c..c16490c 100644 --- a/server/src/test/java/server/api/RecipeControllerTest.java +++ b/server/src/test/java/server/api/RecipeControllerTest.java @@ -13,6 +13,8 @@ import org.springframework.http.HttpStatus; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.test.context.ActiveProfiles; import server.WebSocketConfig; +import server.database.IngredientRepository; +import server.database.RecipeIngredientRepository; import server.database.RecipeRepository; import java.util.ArrayList; @@ -45,12 +47,21 @@ public class RecipeControllerTest { private final RecipeRepository recipeRepository; private List recipeIds; public static final int NUM_RECIPES = 10; + private final IngredientRepository ingredientRepository; + private final RecipeIngredientRepository recipeIngredientRepository; // Injects a test repository into the test class @Autowired - public RecipeControllerTest(RecipeRepository recipeRepository, SimpMessagingTemplate template) { + public RecipeControllerTest( + RecipeRepository recipeRepository, + SimpMessagingTemplate template, + IngredientRepository ingredientRepository, + RecipeIngredientRepository recipeIngredientRepository + ) { this.recipeRepository = recipeRepository; this.template = template; + this.ingredientRepository = ingredientRepository; + this.recipeIngredientRepository = recipeIngredientRepository; } @BeforeEach @@ -59,7 +70,12 @@ public class RecipeControllerTest { .range(0, NUM_RECIPES) .mapToObj(x -> new Recipe(null, "Recipe " + x, List.of(), List.of())) .toList(); - controller = new RecipeController(recipeRepository, template); + controller = new RecipeController( + recipeRepository, + template, + ingredientRepository, + recipeIngredientRepository + ); Set tags = info.getTags(); List ids = new ArrayList<>();