DefaultResourceConsumptionService implements ResourceConsumptionService { @Override public Optional<CompositeResourceConsumption> getSystemConsumption() { return latestEvaluation == null ? Optional.empty() : Optional.of(latestEvaluation.getSystemConsumption()); } @Inject  DefaultResourceConsumptionService(ApplicationSlaManagementService applicationSlaManagementService,
                                             V3JobOperations v3JobOperations,
                                             Registry registry); @VisibleForTesting  DefaultResourceConsumptionService(Supplier<ConsumptionEvaluationResult> evaluator,
                                      Registry registry,
                                      Scheduler scheduler); @Activator Observable<Void> enterActiveMode(); @PreDestroy void shutdown(); @Override Optional<CompositeResourceConsumption> getSystemConsumption(); @Override Observable<ResourceConsumptionEvent> resourceConsumptionEvents();  }
@Test public void testGetSystemConsumption() throws Exception { lastEvaluation.set(generator.getEvaluation()); testScheduler.advanceTimeBy(DefaultResourceConsumptionService.UPDATE_INTERVAL_MS, TimeUnit.MILLISECONDS); Optional<CompositeResourceConsumption> resultOpt = resourceConsumptionService.getSystemConsumption(); assertThat(resultOpt).isNotEmpty(); }