### Question:
UnreferencedHousekeepingPathSchedulerService implements SchedulerService { @Override @TimedTaggable("paths-scheduled") public void scheduleForHousekeeping(HousekeepingEntity housekeepingEntity) { HousekeepingPath housekeepingPath = (HousekeepingPath) housekeepingEntity; try { housekeepingPathRepository.save(housekeepingPath); log.info(format("Successfully scheduled %s", housekeepingPath)); } catch (Exception e) { throw new BeekeeperException(format("Unable to schedule %s", housekeepingPath), e); } } @Autowired  UnreferencedHousekeepingPathSchedulerService(HousekeepingPathRepository housekeepingPathRepository); @Override LifecycleEventType getLifecycleEventType(); @Override @TimedTaggable("paths-scheduled") void scheduleForHousekeeping(HousekeepingEntity housekeepingEntity);  }### Answer:
@Test public void typicalScheduleForHousekeeping() { HousekeepingPath path = new HousekeepingPath.Builder() .creationTimestamp(LocalDateTime.now()) .cleanupDelay(Duration.parse("P3D")) .build(); unreferencedHousekeepingPathSchedulerService.scheduleForHousekeeping(path); verify(housekeepingPathRepository).save(path); }
@Test public void scheduleFails() { HousekeepingPath path = new HousekeepingPath.Builder() .path("path_to_schedule") .creationTimestamp(LocalDateTime.now()) .cleanupDelay(Duration.parse("P3D")) .build(); when(housekeepingPathRepository.save(path)).thenThrow(new RuntimeException()); assertThatExceptionOfType(BeekeeperException.class) .isThrownBy(() -> unreferencedHousekeepingPathSchedulerService.scheduleForHousekeeping(path)) .withMessage(format("Unable to schedule %s", path)); verify(housekeepingPathRepository).save(path); }