DefaultCapacityMonitoringService implements CapacityMonitoringService { @Override public Observable<Void> refresh() { return invoker.recompute(); } DefaultCapacityMonitoringService(CapacityManagementConfiguration configuration,
                                            CapacityGuaranteeStrategy strategy,
                                            ApplicationSlaStore storage,
                                            AgentManagementService agentManagementService,
                                            Registry registry,
                                            Scheduler scheduler); @Inject  DefaultCapacityMonitoringService(CapacityManagementConfiguration configuration,
                                            CapacityGuaranteeStrategy strategy,
                                            ApplicationSlaStore storage,
                                            AgentManagementService agentManagementService,
                                            Registry registry); @PreDestroy void shutdown(); @Activator Observable<Void> enterActiveMode(); @Override Observable<Void> refresh();  }
@Test public void testDirectRefresh() throws Exception { setupMocksForApp(1, 1, CRITICAL_APP, FLEX_APP); ExtTestSubscriber<Void> replySubscriber = new ExtTestSubscriber<>(); capacityMonitoringService.refresh().subscribe(replySubscriber); testScheduler.triggerActions(); verify(agentManagementService, times(1)) .updateCapacity(CRITICAL_INSTANCE_GROUP_ID, Optional.of(1), Optional.empty()); verify(agentManagementService, times(0)) .updateCapacity(FLEX_INSTANCE_GROUP_ID, Optional.of(1), Optional.empty()); replySubscriber.assertOnCompleted(); }