@Test public void delete() { assertEquals(advice.getId(), adviceService.delete(advice.getId())); verify(adviceRepo, times(1)).deleteById(anyLong()); }
@Override public Long delete(Long id) { try { adviceRepo.deleteById(id); } catch (EmptyResultDataAccessException e) { throw new NotDeletedException(ErrorMessage.ADVICE_NOT_DELETED); } return id; }
AdviceServiceImpl implements AdviceService { @Override public Long delete(Long id) { try { adviceRepo.deleteById(id); } catch (EmptyResultDataAccessException e) { throw new NotDeletedException(ErrorMessage.ADVICE_NOT_DELETED); } return id; } }
AdviceServiceImpl implements AdviceService { @Override public Long delete(Long id) { try { adviceRepo.deleteById(id); } catch (EmptyResultDataAccessException e) { throw new NotDeletedException(ErrorMessage.ADVICE_NOT_DELETED); } return id; } @Autowired  AdviceServiceImpl(AdviceRepo adviceRepo, HabitDictionaryRepo habitDictionaryRepo,
                             AdviceTranslationRepo adviceTranslationRepo, ModelMapper modelMapper); }
AdviceServiceImpl implements AdviceService { @Override public Long delete(Long id) { try { adviceRepo.deleteById(id); } catch (EmptyResultDataAccessException e) { throw new NotDeletedException(ErrorMessage.ADVICE_NOT_DELETED); } return id; } @Autowired  AdviceServiceImpl(AdviceRepo adviceRepo, HabitDictionaryRepo habitDictionaryRepo,
                             AdviceTranslationRepo adviceTranslationRepo, ModelMapper modelMapper); @Override List<LanguageTranslationDTO> getAllAdvices(); @Override LanguageTranslationDTO getRandomAdviceByHabitIdAndLanguage(Long id, String language); @Override AdviceDTO getAdviceById(Long id); @Override AdviceDTO getAdviceByName(String language, String name); @Override Advice save(AdvicePostDTO advicePostDTO); @Override Advice update(AdvicePostDTO advice, Long id); @Override Long delete(Long id); }
AdviceServiceImpl implements AdviceService { @Override public Long delete(Long id) { try { adviceRepo.deleteById(id); } catch (EmptyResultDataAccessException e) { throw new NotDeletedException(ErrorMessage.ADVICE_NOT_DELETED); } return id; } @Autowired  AdviceServiceImpl(AdviceRepo adviceRepo, HabitDictionaryRepo habitDictionaryRepo,
                             AdviceTranslationRepo adviceTranslationRepo, ModelMapper modelMapper); @Override List<LanguageTranslationDTO> getAllAdvices(); @Override LanguageTranslationDTO getRandomAdviceByHabitIdAndLanguage(Long id, String language); @Override AdviceDTO getAdviceById(Long id); @Override AdviceDTO getAdviceByName(String language, String name); @Override Advice save(AdvicePostDTO advicePostDTO); @Override Advice update(AdvicePostDTO advice, Long id); @Override Long delete(Long id);  }