CountDistinct extends DistinctAggregator { @Override public Object terminate() { return this.distinct.size(); }  @Override Object terminate();  }
@Test public void terminateShouldCorrectlyComputeDistinctAccumulatedValuesCount() { distinctAggregator.accumulate(5); distinctAggregator.accumulate(5); distinctAggregator.accumulate(10); distinctAggregator.accumulate(10); distinctAggregator.accumulate(15); distinctAggregator.accumulate(15); Object result = distinctAggregator.terminate(); assertThat(result).isInstanceOf(Number.class); assertThat(((Number) result).intValue()).isEqualTo(3); }