@Test void getById() { Habit habit = ModelUtils.getHabit(); when(habitRepo.findById(anyLong())).thenReturn(Optional.of(habit)); assertEquals(habit, habitService.getById(1L)); }
@Override public Habit getById(Long id) { return habitRepo.findById(id) .orElseThrow(() -> new WrongIdException(ErrorMessage.HABIT_NOT_FOUND_BY_ID + id)); }
HabitServiceImpl implements HabitService { @Override public Habit getById(Long id) { return habitRepo.findById(id) .orElseThrow(() -> new WrongIdException(ErrorMessage.HABIT_NOT_FOUND_BY_ID + id)); } }
HabitServiceImpl implements HabitService { @Override public Habit getById(Long id) { return habitRepo.findById(id) .orElseThrow(() -> new WrongIdException(ErrorMessage.HABIT_NOT_FOUND_BY_ID + id)); }  }
HabitServiceImpl implements HabitService { @Override public Habit getById(Long id) { return habitRepo.findById(id) .orElseThrow(() -> new WrongIdException(ErrorMessage.HABIT_NOT_FOUND_BY_ID + id)); }  @Override HabitDictionaryTranslation getHabitDictionaryTranslation(Habit habit, String languageCode); @Override Habit getById(Long id); @Transactional @Override HabitCreateDto assignHabitForUser(Long habitId, User user); @Override List<HabitDto> getAllHabitsDto(); }
HabitServiceImpl implements HabitService { @Override public Habit getById(Long id) { return habitRepo.findById(id) .orElseThrow(() -> new WrongIdException(ErrorMessage.HABIT_NOT_FOUND_BY_ID + id)); }  @Override HabitDictionaryTranslation getHabitDictionaryTranslation(Habit habit, String languageCode); @Override Habit getById(Long id); @Transactional @Override HabitCreateDto assignHabitForUser(Long habitId, User user); @Override List<HabitDto> getAllHabitsDto();  }