@Test public void updateTest() { OpeningHours updated = new OpeningHours(); when(openHoursRepo.findById(anyLong())).thenReturn(Optional.of(updated)); when(openHoursRepo.save(any())).thenReturn(updated); openHoursService.update(anyLong(), updated); OpeningHours foundEntity = openHoursService.findById(anyLong()); assertEquals(updated, foundEntity); }
@Override public OpeningHours update(Long id, OpeningHours updatedHours) { log.info(LogMessage.IN_UPDATE); OpeningHours updatable = findById(id); updatable.setOpenTime(updatedHours.getOpenTime()); updatable.setCloseTime(updatedHours.getCloseTime()); updatable.setWeekDay(updatedHours.getWeekDay()); updatable.setPlace(updatedHours.getPlace()); return hoursRepo.save(updatable); }
OpenHoursServiceImpl implements OpenHoursService { @Override public OpeningHours update(Long id, OpeningHours updatedHours) { log.info(LogMessage.IN_UPDATE); OpeningHours updatable = findById(id); updatable.setOpenTime(updatedHours.getOpenTime()); updatable.setCloseTime(updatedHours.getCloseTime()); updatable.setWeekDay(updatedHours.getWeekDay()); updatable.setPlace(updatedHours.getPlace()); return hoursRepo.save(updatable); } }
OpenHoursServiceImpl implements OpenHoursService { @Override public OpeningHours update(Long id, OpeningHours updatedHours) { log.info(LogMessage.IN_UPDATE); OpeningHours updatable = findById(id); updatable.setOpenTime(updatedHours.getOpenTime()); updatable.setCloseTime(updatedHours.getCloseTime()); updatable.setWeekDay(updatedHours.getWeekDay()); updatable.setPlace(updatedHours.getPlace()); return hoursRepo.save(updatable); }  }
OpenHoursServiceImpl implements OpenHoursService { @Override public OpeningHours update(Long id, OpeningHours updatedHours) { log.info(LogMessage.IN_UPDATE); OpeningHours updatable = findById(id); updatable.setOpenTime(updatedHours.getOpenTime()); updatable.setCloseTime(updatedHours.getCloseTime()); updatable.setWeekDay(updatedHours.getWeekDay()); updatable.setPlace(updatedHours.getPlace()); return hoursRepo.save(updatable); }  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); }
OpenHoursServiceImpl implements OpenHoursService { @Override public OpeningHours update(Long id, OpeningHours updatedHours) { log.info(LogMessage.IN_UPDATE); OpeningHours updatable = findById(id); updatable.setOpenTime(updatedHours.getOpenTime()); updatable.setCloseTime(updatedHours.getCloseTime()); updatable.setWeekDay(updatedHours.getWeekDay()); updatable.setPlace(updatedHours.getPlace()); return hoursRepo.save(updatable); }  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);  }