public void deleteFavorite(long favoriteId) {
    Favorite favorite = favoriteRepository.findById(favoriteId).orElse(null);

    checkUserOperatePermission(favorite);

    favoriteRepository.delete(favorite);
  }
@Test(expected = BadRequestException.class)
  @Sql(scripts = "/sql/favorites/favorites.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
  @Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
  public void testDeleteFavoriteFail() {
    long anotherPersonFavoriteId = 23L;
    favoriteService.deleteFavorite(anotherPersonFavoriteId);
    Assert.assertNull(favoriteRepository.findById(anotherPersonFavoriteId).orElse(null));
  }