@Test
public void reportsTimers() throws Exception {

    final Timer timer = mock(Timer.class);
    when(timer.getCount()).thenReturn(1L);
    when(timer.getMeanRate()).thenReturn(2.0);
    when(timer.getOneMinuteRate()).thenReturn(3.0);
    when(timer.getFiveMinuteRate()).thenReturn(4.0);
    when(timer.getFifteenMinuteRate()).thenReturn(5.0);
    final Snapshot snapshot = mock(Snapshot.class);
    when(snapshot.getMax()).thenReturn(TimeUnit.MILLISECONDS.toNanos(100));
    when(snapshot.getMean()).thenReturn((double) TimeUnit.MILLISECONDS.toNanos(200));
    when(snapshot.getMin()).thenReturn(TimeUnit.MILLISECONDS.toNanos(300));
    when(snapshot.getStdDev()).thenReturn((double) TimeUnit.MILLISECONDS.toNanos(400));
    when(snapshot.getMedian()).thenReturn((double) TimeUnit.MILLISECONDS.toNanos(500));
    when(snapshot.get75thPercentile()).thenReturn((double) TimeUnit.MILLISECONDS.toNanos(600));
    when(snapshot.get95thPercentile()).thenReturn((double) TimeUnit.MILLISECONDS.toNanos(700));
    when(snapshot.get98thPercentile()).thenReturn((double) TimeUnit.MILLISECONDS.toNanos(800));
    when(snapshot.get99thPercentile()).thenReturn((double) TimeUnit.MILLISECONDS.toNanos(900));
    when(snapshot.get999thPercentile()).thenReturn((double) TimeUnit.MILLISECONDS
        .toNanos(1000));
    when(timer.getSnapshot()).thenReturn(snapshot);
    reporter.report(map(),
        map(),
        map(),
        map(),
        map("timer", timer));
    final InOrder inOrder = inOrder(graphite);
    inOrder.verify(graphite).connect();
    inOrder.verify(graphite).send("prefix.timer.max", "100.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.mean", "200.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.min", "300.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.stddev", "400.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.p50", "500.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.p75", "600.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.p95", "700.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.p98", "800.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.p99", "900.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.p999", "1000.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.count", "1", timestamp);
    inOrder.verify(graphite).send("prefix.timer.m1_rate", "3.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.m5_rate", "4.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.m15_rate", "5.00", timestamp);
    inOrder.verify(graphite).send("prefix.timer.mean_rate", "2.00", timestamp);
    inOrder.verify(graphite).flush();
    inOrder.verify(graphite).close();
    verifyNoMoreInteractions(graphite);
    reporter.close();
}