### Question:
JdbcMetricsAccessor implements IMetricsAccessor { @Override public ResponseStatsSummaryBean getResponseStatsSummary(String organizationId, String apiId, String version, DateTime from, DateTime to) { try { QueryRunner run = new QueryRunner(ds); String sql = "SELECT resp_type, count(*) FROM gw_requests WHERE api_org_id = ? AND api_id = ? AND api_version = ? AND rstart >= ? AND rstart < ? GROUP BY resp_type"; ResultSetHandler<ResponseStatsSummaryBean> handler = new ResponseStatsSummaryHandler(); return run.query(sql, handler, organizationId, apiId, version, from.getMillis(), to.getMillis()); } catch (SQLException e) { e.printStackTrace(); return new ResponseStatsSummaryBean(); } } JdbcMetricsAccessor(Map<String, String> config); @Override UsageHistogramBean getUsage(String organizationId, String apiId, String version,
            HistogramIntervalType interval, DateTime from, DateTime to); @Override UsagePerClientBean getUsagePerClient(String organizationId, String apiId, String version,
            DateTime from, DateTime to); @Override UsagePerPlanBean getUsagePerPlan(String organizationId, String apiId, String version,
            DateTime from, DateTime to); @Override ResponseStatsHistogramBean getResponseStats(String organizationId, String apiId, String version,
            HistogramIntervalType interval, DateTime from, DateTime to); @Override ResponseStatsSummaryBean getResponseStatsSummary(String organizationId, String apiId,
            String version, DateTime from, DateTime to); @Override ResponseStatsPerClientBean getResponseStatsPerClient(String organizationId, String apiId,
            String version, DateTime from, DateTime to); @Override ResponseStatsPerPlanBean getResponseStatsPerPlan(String organizationId, String apiId,
            String version, DateTime from, DateTime to); @Override ClientUsagePerApiBean getClientUsagePerApi(String organizationId, String clientId, String version,
            DateTime from, DateTime to);  }### Answer:
@Test public void testGetResponseStatsSummary() { Map<String, String> config = new HashMap<>(); config.put("datasource.jndi-location", DB_JNDI_LOC); JdbcMetricsAccessor accessor = new JdbcMetricsAccessor(config); DateTime from = ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.UTC).parseDateTime("2016-02-01T00:00:00Z"); DateTime to = ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.UTC).parseDateTime("2016-03-01T00:00:00Z"); ResponseStatsSummaryBean stats = accessor.getResponseStatsSummary("TestOrg", "TestApi", "1.0", from, to); Assert.assertEquals(18, stats.getTotal()); Assert.assertEquals(3, stats.getFailures()); Assert.assertEquals(1, stats.getErrors()); }