@Test(expected = NotFoundException.class) public void deleteByIdGivenIdNullThenThrowException() { categoryService.deleteById(null); }
@Override public Long deleteById(Long id) { log.info(LogMessage.IN_DELETE_BY_ID, id); Category category = findById(id); if (!category.getPlaces().isEmpty()) { throw new BadRequestException(ErrorMessage.NOT_SAVE_DELETION); } categoryRepo.delete(category); return id; }
CategoryServiceImpl implements CategoryService { @Override public Long deleteById(Long id) { log.info(LogMessage.IN_DELETE_BY_ID, id); Category category = findById(id); if (!category.getPlaces().isEmpty()) { throw new BadRequestException(ErrorMessage.NOT_SAVE_DELETION); } categoryRepo.delete(category); return id; } }
CategoryServiceImpl implements CategoryService { @Override public Long deleteById(Long id) { log.info(LogMessage.IN_DELETE_BY_ID, id); Category category = findById(id); if (!category.getPlaces().isEmpty()) { throw new BadRequestException(ErrorMessage.NOT_SAVE_DELETION); } categoryRepo.delete(category); return id; }  }
CategoryServiceImpl implements CategoryService { @Override public Long deleteById(Long id) { log.info(LogMessage.IN_DELETE_BY_ID, id); Category category = findById(id); if (!category.getPlaces().isEmpty()) { throw new BadRequestException(ErrorMessage.NOT_SAVE_DELETION); } categoryRepo.delete(category); return id; }  @Override Category save(CategoryDto dto); @Override Category save(Category category); @Override List<Category> findAll(); @Override Category findById(Long id); @Override Category update(Long id, Category category); @Override Long deleteById(Long id); @Override Category findByName(String name); @Override List<CategoryDto> findAllCategoryDto(); }
CategoryServiceImpl implements CategoryService { @Override public Long deleteById(Long id) { log.info(LogMessage.IN_DELETE_BY_ID, id); Category category = findById(id); if (!category.getPlaces().isEmpty()) { throw new BadRequestException(ErrorMessage.NOT_SAVE_DELETION); } categoryRepo.delete(category); return id; }  @Override Category save(CategoryDto dto); @Override Category save(Category category); @Override List<Category> findAll(); @Override Category findById(Long id); @Override Category update(Long id, Category category); @Override Long deleteById(Long id); @Override Category findByName(String name); @Override List<CategoryDto> findAllCategoryDto();  }