AsynchronousSpanSink implements SpanSink { @Override public void record(SpanData spanData) { Runnable job = jobFactory.createJob(spanData); executor.execute(job); } AsynchronousSpanSink(JobFactory jobFactory);  AsynchronousSpanSink(ExecutorService executor, JobFactory jobFactory); @Override void record(SpanData spanData); int shutdown(long timeout, TimeUnit timeunit);  }
@Test public void testSubmitsExpectedRecordTasksToExecutor() { ExecutorService executor = mock(ExecutorService.class); AsynchronousSpanSink.JobFactory jobFactory = mock(AsynchronousSpanSink.JobFactory.class); SpanSink sink = new AsynchronousSpanSink(executor, jobFactory); SpanData spanData = new BeanSpanData(); Runnable runnable = new Runnable() { @Override public void run() { } }; when(jobFactory.createJob(eq(spanData))).thenReturn(runnable); sink.record(spanData); verify(jobFactory).createJob(eq(spanData)); verify(executor).execute(eq(runnable)); }