public void setMockMetrics(MetricName name, Metric metric) {
        mockMetrics.put(name, metric);
    }
Set a mock metric for testing purpose
clients/src/main/java/org/apache/kafka/clients/producer/MockProducer.java