@Test void findByIdNotFoundExceptionTest() { Long habitDictionaryId = getHabitDictionary().getId(); assertThrows(NotFoundException.class, () -> { habitDictionaryService.findById(habitDictionaryId); }); }
@Override public HabitDictionary findById(Long id) { return habitDictionaryRepo.findById(id) .orElseThrow(() -> new NotFoundException(ErrorMessage.HABIT_NOT_FOUND_BY_ID + id)); }
HabitDictionaryServiceImpl implements HabitDictionaryService { @Override public HabitDictionary findById(Long id) { return habitDictionaryRepo.findById(id) .orElseThrow(() -> new NotFoundException(ErrorMessage.HABIT_NOT_FOUND_BY_ID + id)); } }
HabitDictionaryServiceImpl implements HabitDictionaryService { @Override public HabitDictionary findById(Long id) { return habitDictionaryRepo.findById(id) .orElseThrow(() -> new NotFoundException(ErrorMessage.HABIT_NOT_FOUND_BY_ID + id)); }  }
HabitDictionaryServiceImpl implements HabitDictionaryService { @Override public HabitDictionary findById(Long id) { return habitDictionaryRepo.findById(id) .orElseThrow(() -> new NotFoundException(ErrorMessage.HABIT_NOT_FOUND_BY_ID + id)); }  @Override HabitDictionary findById(Long id); }
HabitDictionaryServiceImpl implements HabitDictionaryService { @Override public HabitDictionary findById(Long id) { return habitDictionaryRepo.findById(id) .orElseThrow(() -> new NotFoundException(ErrorMessage.HABIT_NOT_FOUND_BY_ID + id)); }  @Override HabitDictionary findById(Long id);  }