@Test
public void updatesTimerForContextClass() throws Exception {

    final StatementNameStrategy strategy = new SmartNameStrategy();
    final InstrumentedTimingCollector collector = new InstrumentedTimingCollector(registry,
                                                                                  strategy);
    final StatementContext ctx = mock(StatementContext.class);
    doReturn("SELECT 1").when(ctx).getRawSql();
    doReturn(getClass().getName()).when(ctx).getAttribute(NameStrategies.STATEMENT_CLASS);
    doReturn("updatesTimerForContextClass").when(ctx)
            .getAttribute(NameStrategies.STATEMENT_NAME);
    collector.collect(TimeUnit.SECONDS.toNanos(3), ctx);
    final String name = strategy.getStatementName(ctx);
    final Timer timer = registry.timer(name);
    assertThat(name)
            .isEqualTo(name(getClass(), "updatesTimerForContextClass"));
    assertThat(timer.getSnapshot().getMax())
            .isEqualTo(3000000000L);
}