### Question:
RecipeService extends AbstractArchivistService<Recipe> implements ResourceBasedCrnProvider { public Recipe delete(NameOrCrn recipeNameOrCrn, Long workspaceId) { Recipe toDelete = get(recipeNameOrCrn, workspaceId); Recipe deleted = super.delete(toDelete); grpcUmsClient.notifyResourceDeleted(deleted.getResourceCrn(), MDCUtils.getRequestId()); return deleted; }  Recipe delete(NameOrCrn recipeNameOrCrn, Long workspaceId); @Override Set<Recipe> deleteMultipleByNameFromWorkspace(Set<String> names, Long workspaceId); Recipe get(NameOrCrn recipeNameOrCrn, Long workspaceId); Set<Recipe> getRecipesByNamesForWorkspace(Workspace workspace, Set<String> recipeNames); Recipe createForLoggedInUser(Recipe recipe, @Nonnull Long workspaceId, String accountId, String creator); Set<RecipeView> findAllViewByWorkspaceId(Long workspaceId); @Override WorkspaceResourceRepository<Recipe, Long> repository(); @Override String getResourceCrnByResourceName(String resourceName); @Override List<String> getResourceCrnListByResourceNameList(List<String> resourceNames); @Override List<String> getResourceCrnsInAccount(); @Override AuthorizationResourceType getResourceType();  }### Answer:
@Test public void testDeleteWhenDtoNameFilledThenDeleteCalled() { Recipe recipe = getRecipe(); when(recipeRepository.findByNameAndWorkspaceId(recipe.getName(), recipe.getWorkspace().getId())).thenReturn(Optional.of(recipe)); Recipe result = underTest.delete(NameOrCrn.ofName(recipe.getName()), recipe.getWorkspace().getId()); assertEquals(recipe, result); verify(recipeRepository, times(1)).findByNameAndWorkspaceId(anyString(), anyLong()); verify(recipeRepository, times(1)).findByNameAndWorkspaceId(recipe.getName(), recipe.getWorkspace().getId()); verify(recipeRepository, times(1)).save(any(Recipe.class)); verify(recipeRepository, times(1)).save(recipe); }
@Test public void testDeleteWhenDtoCrnFilledThenDeleteCalled() { Recipe recipe = getRecipe(); when(recipeRepository.findByResourceCrnAndWorkspaceId(recipe.getResourceCrn(), recipe.getWorkspace().getId())).thenReturn(Optional.of(recipe)); Recipe result = underTest.delete(NameOrCrn.ofCrn(recipe.getResourceCrn()), recipe.getWorkspace().getId()); assertEquals(recipe, result); verify(recipeRepository, times(1)).findByResourceCrnAndWorkspaceId(anyString(), anyLong()); verify(recipeRepository, times(1)).findByResourceCrnAndWorkspaceId(recipe.getResourceCrn(), recipe.getWorkspace().getId()); verify(recipeRepository, times(1)).save(any(Recipe.class)); verify(recipeRepository, times(1)).save(recipe); }