Collection<TopicSensors.Stat> getAggregateMetrics(
      final List<TopicSensors.Stat> allStats
  ) {
    return allStats.stream().collect(toImmutableMap(
        TopicSensors.Stat::name,
        Functions.identity(),
        (first, other) -> first.aggregate(other.getValue())
    )).values();
  }
@Test
  public void shouldAggregateStats() {
    final MetricCollectors metricCollectors = new MetricCollectors();
    final List<TopicSensors.Stat> stats = Arrays.asList(
        new TopicSensors.Stat("metric", 1, 1L),
        new TopicSensors.Stat("metric", 1, 1L),
        new TopicSensors.Stat("metric", 1, 1L)
    );
    final Collection<TopicSensors.Stat> aggregateMetrics =
        metricCollectors.getAggregateMetrics(stats);
    assertThat(aggregateMetrics.size(), equalTo(1));
    assertThat(aggregateMetrics.iterator().next().getValue(), equalTo(3.0));
  }