@Test public void findByExistingId() { when(breakTimeRepo.findById(validBreakTime.getId())).thenReturn(Optional.of(validBreakTime)); assertEquals(validBreakTime, breakTimeService.findById(validBreakTime.getId())); }
@Override public BreakTime findById(Long id) { log.info(LogMessage.IN_FIND_BY_ID, id); return repo .findById(id) .orElseThrow( () -> new NotFoundException(ErrorMessage.BREAK_TIME_NOT_FOUND_BY_ID + id)); }
BreakTimeServiceImpl implements BreakTimeService { @Override public BreakTime findById(Long id) { log.info(LogMessage.IN_FIND_BY_ID, id); return repo .findById(id) .orElseThrow( () -> new NotFoundException(ErrorMessage.BREAK_TIME_NOT_FOUND_BY_ID + id)); } }
BreakTimeServiceImpl implements BreakTimeService { @Override public BreakTime findById(Long id) { log.info(LogMessage.IN_FIND_BY_ID, id); return repo .findById(id) .orElseThrow( () -> new NotFoundException(ErrorMessage.BREAK_TIME_NOT_FOUND_BY_ID + id)); }  }
BreakTimeServiceImpl implements BreakTimeService { @Override public BreakTime findById(Long id) { log.info(LogMessage.IN_FIND_BY_ID, id); return repo .findById(id) .orElseThrow( () -> new NotFoundException(ErrorMessage.BREAK_TIME_NOT_FOUND_BY_ID + id)); }  @Override BreakTime save(BreakTime breakTime); @Override BreakTime findById(Long id); @Override Long deleteById(Long id); @Override List<BreakTime> findAll(); }
BreakTimeServiceImpl implements BreakTimeService { @Override public BreakTime findById(Long id) { log.info(LogMessage.IN_FIND_BY_ID, id); return repo .findById(id) .orElseThrow( () -> new NotFoundException(ErrorMessage.BREAK_TIME_NOT_FOUND_BY_ID + id)); }  @Override BreakTime save(BreakTime breakTime); @Override BreakTime findById(Long id); @Override Long deleteById(Long id); @Override List<BreakTime> findAll();  }