public MetricConsumer newInstance() {
        if (factories.length == 1) {
            return factories[0].newInstance();
        }
        MetricConsumer[] consumers = new MetricConsumer[factories.length];
        for (int i = 0; i < factories.length; ++i) {
            consumers[i] = factories[i].newInstance();
        }
        return new ForwardingMetricConsumer(consumers);
    }
@Test
    void requireThatMultipleConsumersAreDelegated() {
        MetricConsumer foo = Mockito.mock(MetricConsumer.class);
        MetricConsumer bar = Mockito.mock(MetricConsumer.class);
        MetricConsumerProvider provider = MetricConsumerProviders.newSingletonFactories(foo, bar);
        MetricConsumer consumer = provider.newInstance();
        assertNotSame(foo, consumer);
        assertNotSame(bar, consumer);
        consumer.add("foo", 6, null);
        Mockito.verify(foo, Mockito.times(1)).add("foo", 6, null);
        Mockito.verify(bar, Mockito.times(1)).add("foo", 6, null);
    }