### Question:
FavoritePlaceServiceImpl implements FavoritePlaceService { @Override @Transactional public Long deleteByUserEmailAndPlaceId(Long placeId, String userEmail) { log.info(LogMessage.IN_DELETE_BY_PLACE_ID_AND_USER_EMAIL, userEmail, placeId); FavoritePlace favoritePlace = repo.findByPlaceIdAndUserEmail(placeId, userEmail); if (favoritePlace == null) { throw new WrongIdException(ErrorMessage.FAVORITE_PLACE_NOT_FOUND); } repo.delete(favoritePlace); return favoritePlace.getId(); }  @Override FavoritePlaceDto save(FavoritePlaceDto favoritePlaceDto, String userEmail); @Override FavoritePlaceDto update(FavoritePlaceDto favoritePlaceDto, String userEmail); @Override List<FavoritePlaceDto> findAllByUserEmail(String email); @Override @Transactional Long deleteByUserEmailAndPlaceId(Long placeId, String userEmail); @Override FavoritePlace findByPlaceId(Long placeId); @Override PlaceInfoDto getInfoFavoritePlace(Long placeId); @Override PlaceByBoundsDto getFavoritePlaceWithLocation(Long placeId, String email);  }### Answer:
@Test public void deleteByIdAndUserEmail() { FavoritePlace fp = ModelUtils.getFavoritePlace(); when(repo.findByPlaceIdAndUserEmail(anyLong(), anyString())).thenReturn(fp); assertEquals(fp.getId(), favoritePlaceService.deleteByUserEmailAndPlaceId(fp.getId(), fp.getUser().getEmail())); verify(repo, times(1)).findByPlaceIdAndUserEmail(anyLong(), anyString()); verify(repo, times(1)).delete(any()); }
@Test public void deleteByIdAndUserEmail_FavoritePlaceNotExist() { FavoritePlace fp = ModelUtils.getFavoritePlace(); Exception exception = assertThrows( WrongIdException.class, () -> { when(repo.findByPlaceIdAndUserEmail(anyLong(), anyString())).thenReturn(null); favoritePlaceService.deleteByUserEmailAndPlaceId(fp.getId(), fp.getUser().getEmail()); verify(repo, times(1)).findByPlaceIdAndUserEmail(anyLong(), anyString()); verify(repo, times(1)).delete(any()); }); String expectedMessage = ErrorMessage.FAVORITE_PLACE_NOT_FOUND; String actualMessage = exception.getMessage(); assertTrue(actualMessage.contains(expectedMessage)); }