Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing block() calls #4

Open
wants to merge 1 commit into
base: refactor-image-service
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void saveImageFile() throws Exception {
ArgumentCaptor<Recipe> argumentCaptor = ArgumentCaptor.forClass(Recipe.class);

//when
imageService.saveImageFile(id, multipartFile);
imageService.saveImageFile(id, multipartFile).block();

//then
verify(recipeReactiveRepository, times(1)).save(argumentCaptor.capture());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));

Expand All @@ -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());
Expand Down