package no.cantara.performance.messagesampler;

public class LatencyMessageSamplerTest {
    public static void main(String[] args) throws InterruptedException {
        final Object waitBus = new Object();
        TimeWindowSampleCallback callback = latency -> System.out.println(latency.getJson());
        LatencyMessageSampler sampler = new LatencyMessageSampler(callback, 100);
        for (int i=0; i<40; i++) {
            long sentTime = System.currentTimeMillis();
            synchronized (waitBus) {
                waitBus.wait(10, 0);
            }
            sampler.addMessage(sentTime, System.currentTimeMillis());
        }
        System.out.println(sampler.getPrintableStatistics().getJson());
    }
}

@@ -259,44 +259,37 @@
  -%3E 
-System.out.println(latency.getJson()
+latency.printToStandardError(
 );%0A 
@@ -640,27 +640,8 @@
     
-System.out.println(
 samp
@@ -673,17 +673,30 @@
 s().
-getJson()
+printToStandardOutput(
 );%0A 

Test stderr and stdout print methods.