### Question:
LocationServiceImpl implements LocationService { @Override public Long deleteById(Long id) { log.info(LogMessage.IN_DELETE_BY_ID, id); locationRepo.delete(findById(id)); return 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);  }### Answer:
@Test public void deleteByIdTest() { when(locationRepo.findById(anyLong())).thenReturn(Optional.of(new Location())); assertEquals(new Long(1), locationService.deleteById(1L)); }
@Test(expected = NotFoundException.class) public void deleteByIdGivenIdNullThenThrowException() { locationService.deleteById(null); }