@Test
public void updatesTimerForContextGroupTypeAndName() 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("my-group").when(ctx).getAttribute(NameStrategies.STATEMENT_GROUP);
    doReturn("my-type").when(ctx).getAttribute(NameStrategies.STATEMENT_TYPE);
    doReturn("updatesTimerForContextGroupTypeAndName").when(ctx)
            .getAttribute(NameStrategies.STATEMENT_NAME);
    collector.collect(TimeUnit.SECONDS.toNanos(5), ctx);
    final String name = strategy.getStatementName(ctx);
    final Timer timer = registry.timer(name);
    assertThat(name)
            .isEqualTo(name("my-group", "my-type", "updatesTimerForContextGroupTypeAndName"));
    assertThat(timer.getSnapshot().getMax())
            .isEqualTo(5000000000L);
}