@Test(expected = NotFoundException.class) public void updateGivenIdNullThenThrowException() { locationService.update(null, new Location()); }
@Override public Location update(Long id, Location location) { log.info(LogMessage.IN_UPDATE, location); Location updatable = findById(id); updatable.setLat(location.getLat()); updatable.setLng(location.getLng()); updatable.setAddress(location.getAddress()); updatable.setPlace(location.getPlace()); return locationRepo.save(updatable); }
LocationServiceImpl implements LocationService { @Override public Location update(Long id, Location location) { log.info(LogMessage.IN_UPDATE, location); Location updatable = findById(id); updatable.setLat(location.getLat()); updatable.setLng(location.getLng()); updatable.setAddress(location.getAddress()); updatable.setPlace(location.getPlace()); return locationRepo.save(updatable); } }
LocationServiceImpl implements LocationService { @Override public Location update(Long id, Location location) { log.info(LogMessage.IN_UPDATE, location); Location updatable = findById(id); updatable.setLat(location.getLat()); updatable.setLng(location.getLng()); updatable.setAddress(location.getAddress()); updatable.setPlace(location.getPlace()); return locationRepo.save(updatable); }  }
LocationServiceImpl implements LocationService { @Override public Location update(Long id, Location location) { log.info(LogMessage.IN_UPDATE, location); Location updatable = findById(id); updatable.setLat(location.getLat()); updatable.setLng(location.getLng()); updatable.setAddress(location.getAddress()); updatable.setPlace(location.getPlace()); return locationRepo.save(updatable); }  @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 update(Long id, Location location) { log.info(LogMessage.IN_UPDATE, location); Location updatable = findById(id); updatable.setLat(location.getLat()); updatable.setLng(location.getLng()); updatable.setAddress(location.getAddress()); updatable.setPlace(location.getPlace()); return locationRepo.save(updatable); }  @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);  }