@Test public void printReturnsRelevantInformation() { ByteArrayOutputStream output = new ByteArrayOutputStream(); Stats s = new Stats(1, 2, 3, 4, 5, 6, 7, 8, 9); s.print(new PrintStream(output)); assertEquals( "Latency measured with 1 probe(s): \n" + " 2,00 us for 50 percentile\n" + " 3,00 us for 90 percentile\n" + " 4,00 us for 99 percentile\n" + " 5,00 us for 99.9 percentile\n" + " 6,00 us for 99.99 percentile\n" + " 7,00 us best run\n" + " 8,00 us avg run\n" + " 9,00 us worst run\n", output.toString()); }