@Test(expected = NotFoundException.class) public void findByIdGivenIdNullThenThrowException() { locationService.findById(null); }
@Override public Location findById(Long id) { log.info(LogMessage.IN_FIND_BY_ID, id); return locationRepo .findById(id) .orElseThrow( () -> new NotFoundException(ErrorMessage.LOCATION_NOT_FOUND_BY_ID + id)); }
LocationServiceImpl implements LocationService { @Override public Location findById(Long id) { log.info(LogMessage.IN_FIND_BY_ID, id); return locationRepo .findById(id) .orElseThrow( () -> new NotFoundException(ErrorMessage.LOCATION_NOT_FOUND_BY_ID + id)); } }
LocationServiceImpl implements LocationService { @Override public Location findById(Long id) { log.info(LogMessage.IN_FIND_BY_ID, id); return locationRepo .findById(id) .orElseThrow( () -> new NotFoundException(ErrorMessage.LOCATION_NOT_FOUND_BY_ID + id)); }  }
LocationServiceImpl implements LocationService { @Override public Location findById(Long id) { log.info(LogMessage.IN_FIND_BY_ID, id); return locationRepo .findById(id) .orElseThrow( () -> new NotFoundException(ErrorMessage.LOCATION_NOT_FOUND_BY_ID + id)); }  @Override List<Location> findAll(); @Override Location findById(Long id); @Override Location save(Location location); @Override Location update(Long id, Location location); @Override Long deleteById(Long id); @Override Optional<Location> findByLatAndLng(Double lat, Double lng); }
LocationServiceImpl implements LocationService { @Override public Location findById(Long id) { log.info(LogMessage.IN_FIND_BY_ID, id); return locationRepo .findById(id) .orElseThrow( () -> new NotFoundException(ErrorMessage.LOCATION_NOT_FOUND_BY_ID + id)); }  @Override List<Location> findAll(); @Override Location findById(Long id); @Override Location save(Location location); @Override Location update(Long id, Location location); @Override Long deleteById(Long id); @Override Optional<Location> findByLatAndLng(Double lat, Double lng);  }