ReportQueue implements ReportSink { @Override public void report(long systemTimeMillis, Table<String, Map<String, String>, Object> collectedData) { if (!enabled) { return; } clientExecutorService.submit(() -> reportClient.report(systemTimeMillis, collectedData)); } @Inject  ReportQueue(ReportClientConfig reportClientConfig, @ForReportClient ExecutorService clientExecutorService, ReportClient reportClient); @Override void report(long systemTimeMillis, Table<String, Map<String, String>, Object> collectedData);  }
@Test public void testSubmit() { ReportQueue reportQueue = new ReportQueue(new ReportClientConfig().setEnabled(true), clientExecutorService, reportClient); reportQueue.report(100, TESTING_METRIC_DATA); verify(clientExecutorService).submit(any(Runnable.class)); verify(reportClient).report(100, TESTING_METRIC_DATA); verifyNoMoreInteractions(reportClient); }
@Test public void testDisabled() { ReportQueue reportQueue = new ReportQueue(new ReportClientConfig().setEnabled(false), clientExecutorService, reportClient); reportQueue.report(100, TESTING_METRIC_DATA); verifyNoMoreInteractions(clientExecutorService); verifyNoMoreInteractions(reportClient); }