Source:
<code>public void testAsync() throws JsonProcessingException, InterruptedException { TestTraceReporter reporter = new TestTraceReporter(); APMTracer tracer = new APMTracer(reporter); AsyncService service = new AsyncService(tracer); Message message = new Message(); message.getHeaders().put(Constants.HAWKULAR_APM_ID, TEST_APM_ID); message.getHeaders().put(Constants.HAWKULAR_APM_TXN, TEST_BTXN); CountDownLatch latch=new CountDownLatch(1); service.handle(message, obj -> { latch.countDown(); }); latch.await(5, TimeUnit.SECONDS); Wait.until(() -> reporter.getTraces().size() == 1, 5, TimeUnit.SECONDS); assertEquals(1, reporter.getTraces().size()); for (Trace trace : reporter.getTraces()) { <START> System.out.println("TRACE=" + mapper.writeValueAsString(trace)); <END> } Trace trace1 = reporter.getTraces().get(0); assertEquals(TEST_BTXN, trace1.getBusinessTransaction()); assertEquals(1, trace1.getNodes().size()); assertEquals(Consumer.class, trace1.getNodes().get(0).getClass()); Consumer consumer = (Consumer) trace1.getNodes().get(0); assertTrue(consumer.getCorrelationIds().contains(new CorrelationIdentifier(Scope.Interaction, TEST_APM_ID))); assertEquals(1, consumer.getNodes().size()); assertEquals(Producer.class, consumer.getNodes().get(0).getClass()); Producer producer = (Producer) consumer.getNodes().get(0); assertEquals(1, service.getMessages().size()); assertTrue(service.getMessages().get(0).getHeaders().containsKey(Constants.HAWKULAR_APM_ID)); assertTrue(producer.getCorrelationIds().contains(new CorrelationIdentifier(Scope.Interaction, service.getMessages().get(0).getHeaders().get(Constants.HAWKULAR_APM_ID)))); assertEquals(TEST_BTXN, service.getMessages().get(0).getHeaders().get(Constants.HAWKULAR_APM_TXN)); }</code><technical_language>print stdout in lot of tests, is a benefit of it? good for debugging this executed lot of tests is impossible read logs</technical_language>

Target:
public void testAsync() throws JsonProcessingException, InterruptedException { TestTraceReporter reporter = new TestTraceReporter(); APMTracer tracer = new APMTracer(reporter); AsyncService service = new AsyncService(tracer); Message message = new Message(); message.getHeaders().put(Constants.HAWKULAR_APM_ID, TEST_APM_ID); message.getHeaders().put(Constants.HAWKULAR_APM_TXN, TEST_BTXN); CountDownLatch latch=new CountDownLatch(1); service.handle(message, obj -> { latch.countDown(); }); latch.await(5, TimeUnit.SECONDS); Wait.until(() -> reporter.getTraces().size() == 1, 5, TimeUnit.SECONDS); assertEquals(1, reporter.getTraces().size()); Trace trace1 = reporter.getTraces().get(0); assertEquals(TEST_BTXN, trace1.getBusinessTransaction()); assertEquals(1, trace1.getNodes().size()); assertEquals(Consumer.class, trace1.getNodes().get(0).getClass()); Consumer consumer = (Consumer) trace1.getNodes().get(0); assertEquals(1, consumer.getCorrelationIds().size()); assertEquals(consumer.getCorrelationIds().get(0), new CorrelationIdentifier(Scope.Interaction, TEST_APM_ID)); assertEquals(1, consumer.getNodes().size()); assertEquals(Producer.class, consumer.getNodes().get(0).getClass()); Producer producer = (Producer) consumer.getNodes().get(0); assertEquals(1, service.getMessages().size()); assertTrue(service.getMessages().get(0).getHeaders().containsKey(Constants.HAWKULAR_APM_ID)); assertEquals(1, producer.getCorrelationIds().size()); assertEquals(producer.getCorrelationIds().get(0), new CorrelationIdentifier(Scope.Interaction, service.getMessages().get(0).getHeaders().get(Constants.HAWKULAR_APM_ID))); assertEquals(TEST_BTXN, service.getMessages().get(0).getHeaders().get(Constants.HAWKULAR_APM_TXN)); }