### Question:
OpenHoursServiceImpl implements OpenHoursService { @Override public Long deleteById(Long id) { log.info(LogMessage.IN_DELETE_BY_ID, id); hoursRepo.delete(findById(id)); return id; }  List<OpeningHours> getOpenHoursByPlace(Place place); @Override OpeningHours save(OpeningHours hours); @Override List<OpeningHours> findAll(); @Override OpeningHours findById(Long id); @Override OpeningHours update(Long id, OpeningHours updatedHours); @Override Long deleteById(Long id); @Override Set<OpeningHours> findAllByPlaceId(Long placeId); @Override void deleteAllByPlaceId(Long placeId);  }### Answer:
@Test public void deleteByIdTest() { when(openHoursRepo.findById(anyLong())).thenReturn(Optional.of(new OpeningHours())); assertEquals(new Long(1), openHoursService.deleteById(1L)); }
@Test(expected = NotFoundException.class) public void deleteByIdGivenIdNullThenThrowException() { openHoursService.deleteById(null); }