WorkerManager implements WorkerManagerService { @Override public void registerSpaceEnroller(SpaceEnrollerConfig service) { SpaceEnroller spaceEnroller = SpaceEnroller.builder() .clock(clock) .period(service.getIdleDuration()) .spaceEnrollerConfigId(service.getId()) .spaceEnrollerConfigRepository(spaceEnrollerConfigRepository) .cloudFoundryApi(cloudFoundryApi) .applicationRepository(applicationRepository) .deployment(deployment) .build(); spaceEnroller.start(Config.DELAY_BEFORE_FIRST_SERVICE_CHECK); }  @PostConstruct void init(); @Override void registerApplicationStopper(SpaceEnrollerConfig config, String applicationId, String appBindingId); @Override void registerSpaceEnroller(SpaceEnrollerConfig service);  }
@Test public void test_enrollment_task_is_scheduled() throws Exception { String serviceId = "serviceId"; spyWatcher.registerSpaceEnroller(BeanGenerator.createServiceInstance(serviceId)); verify(clock).scheduleTask(eq(serviceId), eq(Config.DELAY_BEFORE_FIRST_SERVICE_CHECK), any(SpaceEnroller.class)); }