@Test
public void testQuotaMetrics() throws Exception {

    final long offset = 0;
    for (int i = 1; i <= 3; i++) {
        Future<RecordMetadata> future = accumulator.append(tp, 0L, "key".getBytes(), "value".getBytes(), null, MAX_BLOCK_TIMEOUT).future;
        sender.run(time.milliseconds()); // send produce request
        client.respond(produceResponse(tp, offset, Errors.NONE.code(), 100 * i));
        sender.run(time.milliseconds());
    }
    Map<MetricName, KafkaMetric> allMetrics = metrics.metrics();
    KafkaMetric avgMetric = allMetrics.get(metrics.metricName("produce-throttle-time-avg", METRIC_GROUP, ""));
    KafkaMetric maxMetric = allMetrics.get(metrics.metricName("produce-throttle-time-max", METRIC_GROUP, ""));
    assertEquals(200, avgMetric.value(), EPS);
    assertEquals(300, maxMetric.value(), EPS);
}