@Test public void testReportsStartup() { ArgumentCaptor<Long> longCaptor = ArgumentCaptor.forClass(Long.class); long lowerBound = currentTimeMillis(); reportScheduler.start(); long upperBound = currentTimeMillis(); verify(reportSink).report(longCaptor.capture(), tableCaptor.capture()); verifyNoMoreInteractions(reportSink); assertBetweenInclusive(longCaptor.getValue(), lowerBound, upperBound); Table<String, Map<String, String>, Object> table = tableCaptor.getValue(); assertEquals(table.cellSet(), ImmutableTable.<String, Map<String, String>, Object>builder() .put("ReportCollector.ServerStart", EXPECTED_VERSION_TAGS, 1) .build() .cellSet()); collectorExecutor.elapseTimeNanosecondBefore(1, MINUTES); verifyNoMoreInteractions(reportSink); }
@PostConstruct public void start() { collectionExecutorService.scheduleAtFixedRate(reportCollector::collectData, 1, 1, TimeUnit.MINUTES); reportSink.report(currentTimeMillis(), ImmutableTable.of("ReportCollector.ServerStart", reportCollector.getVersionTags(), 1)); }
ReportScheduler { @PostConstruct public void start() { collectionExecutorService.scheduleAtFixedRate(reportCollector::collectData, 1, 1, TimeUnit.MINUTES); reportSink.report(currentTimeMillis(), ImmutableTable.of("ReportCollector.ServerStart", reportCollector.getVersionTags(), 1)); } }
ReportScheduler { @PostConstruct public void start() { collectionExecutorService.scheduleAtFixedRate(reportCollector::collectData, 1, 1, TimeUnit.MINUTES); reportSink.report(currentTimeMillis(), ImmutableTable.of("ReportCollector.ServerStart", reportCollector.getVersionTags(), 1)); } @Inject  ReportScheduler(
            ReportCollector reportCollector,
            ReportSink reportSink,
            @ForReportCollector ScheduledExecutorService collectionExecutorService); }
ReportScheduler { @PostConstruct public void start() { collectionExecutorService.scheduleAtFixedRate(reportCollector::collectData, 1, 1, TimeUnit.MINUTES); reportSink.report(currentTimeMillis(), ImmutableTable.of("ReportCollector.ServerStart", reportCollector.getVersionTags(), 1)); } @Inject  ReportScheduler(
            ReportCollector reportCollector,
            ReportSink reportSink,
            @ForReportCollector ScheduledExecutorService collectionExecutorService); @PostConstruct void start(); }
ReportScheduler { @PostConstruct public void start() { collectionExecutorService.scheduleAtFixedRate(reportCollector::collectData, 1, 1, TimeUnit.MINUTES); reportSink.report(currentTimeMillis(), ImmutableTable.of("ReportCollector.ServerStart", reportCollector.getVersionTags(), 1)); } @Inject  ReportScheduler(
            ReportCollector reportCollector,
            ReportSink reportSink,
            @ForReportCollector ScheduledExecutorService collectionExecutorService); @PostConstruct void start();  }