diff --git a/src/main/java/guru/springframework/controllers/IngredientController.java b/src/main/java/guru/springframework/controllers/IngredientController.java index 58fa2757..10de9af6 100755 --- a/src/main/java/guru/springframework/controllers/IngredientController.java +++ b/src/main/java/guru/springframework/controllers/IngredientController.java @@ -36,7 +36,7 @@ public String listIngredients(@PathVariable String recipeId, Model model){ log.debug("Getting ingredient list for recipe id: " + recipeId); // use command object to avoid lazy load errors in Thymeleaf. - model.addAttribute("recipe", recipeService.findCommandById(recipeId)); + model.addAttribute("recipe", recipeService.findCommandById(recipeId).block()); return "recipe/ingredient/list"; } diff --git a/src/test/java/guru/springframework/services/ImageServiceImplTest.java b/src/test/java/guru/springframework/services/ImageServiceImplTest.java index fca554f3..850b9696 100755 --- a/src/test/java/guru/springframework/services/ImageServiceImplTest.java +++ b/src/test/java/guru/springframework/services/ImageServiceImplTest.java @@ -45,7 +45,7 @@ public void saveImageFile() throws Exception { ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Recipe.class); //when - imageService.saveImageFile(id, multipartFile); + imageService.saveImageFile(id, multipartFile).block(); //then verify(recipeReactiveRepository, times(1)).save(argumentCaptor.capture()); diff --git a/src/test/java/guru/springframework/services/IngredientServiceImplTest.java b/src/test/java/guru/springframework/services/IngredientServiceImplTest.java index 57ad695b..c12891c0 100755 --- a/src/test/java/guru/springframework/services/IngredientServiceImplTest.java +++ b/src/test/java/guru/springframework/services/IngredientServiceImplTest.java @@ -123,7 +123,7 @@ public void testDeleteById() throws Exception { when(recipeReactiveRepository.save(any())).thenReturn(Mono.just(recipe)); //when - ingredientService.deleteById("1", "3"); + ingredientService.deleteById("1", "3").block(); //then verify(recipeReactiveRepository, times(1)).findById(anyString()); diff --git a/src/test/java/guru/springframework/services/RecipeServiceImplTest.java b/src/test/java/guru/springframework/services/RecipeServiceImplTest.java index ca27b785..8d22cb7f 100755 --- a/src/test/java/guru/springframework/services/RecipeServiceImplTest.java +++ b/src/test/java/guru/springframework/services/RecipeServiceImplTest.java @@ -13,7 +13,6 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.util.HashSet; import java.util.List; import static org.junit.Assert.assertEquals; @@ -81,8 +80,6 @@ public void getRecipeCommandByIdTest() throws Exception { public void getRecipesTest() throws Exception { Recipe recipe = new Recipe(); - HashSet receipesData = new HashSet(); - receipesData.add(recipe); when(recipeService.getRecipes()).thenReturn(Flux.just(recipe)); @@ -102,7 +99,7 @@ public void testDeleteById() throws Exception { when(recipeReactiveRepository.deleteById(anyString())).thenReturn(Mono.empty()); //when - recipeService.deleteById(idToDelete); + recipeService.deleteById(idToDelete).block(); //then verify(recipeReactiveRepository, times(1)).deleteById(anyString());