From 4a9d69628c354efaf23d3f823d932006ec1667d3 Mon Sep 17 00:00:00 2001
From: Stian Lyng <stianlyng@protonmail.com>
Date: Fri, 21 Apr 2023 11:54:24 +0200
Subject: [PATCH] bugfix: change return type in testGetByName

---
 .../v233/SmartMat/repository/RecipeRepositoryTest.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/test/java/ntnu/idatt2016/v233/SmartMat/repository/RecipeRepositoryTest.java b/src/test/java/ntnu/idatt2016/v233/SmartMat/repository/RecipeRepositoryTest.java
index b8226fe3..7769a542 100644
--- a/src/test/java/ntnu/idatt2016/v233/SmartMat/repository/RecipeRepositoryTest.java
+++ b/src/test/java/ntnu/idatt2016/v233/SmartMat/repository/RecipeRepositoryTest.java
@@ -3,7 +3,6 @@ package ntnu.idatt2016.v233.SmartMat.repository;
 import static org.junit.jupiter.api.Assertions.*;
 
 import java.util.List;
-import java.util.Optional;
 
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,9 +24,10 @@ public class RecipeRepositoryTest {
                 .build();
         recipeRepository.save(recipe);
 
-        Optional<Recipe> foundRecipe = recipeRepository.getByName("Pizza Margherita");
-        assertTrue(foundRecipe.isPresent());
-        assertEquals(recipe.getName(), foundRecipe.get().getName());
+        List<Recipe> foundRecipes = recipeRepository.getByName("Pizza Margherita");
+        assertTrue(foundRecipes.isEmpty());
+        assertEquals(1, foundRecipes.size());
+        assertEquals(recipe.getName(), foundRecipes.get(0).getName());
     }
 
     @Test
-- 
GitLab