### Question:
StopwatchAggregate { void addSample(StopwatchSample sample) { total += sample.getTotal(); counter += sample.getCounter(); if (min > sample.getMin()) { min = sample.getMin(); minTimestamp = sample.getMinTimestamp(); } if (max < sample.getMax()) { max = sample.getMax(); maxTimestamp = sample.getMaxTimestamp(); } active += sample.getActive(); if (maxActive < sample.getMaxActive()) { maxActive = sample.getMaxActive(); maxActiveTimestamp = sample.getMaxActiveTimestamp(); } } StopwatchAggregate(); long getTotal(); long getCounter(); long getMin(); long getMax(); long getMinTimestamp(); long getMaxTimestamp(); long getActive(); long getMaxActive(); long getMaxActiveTimestamp(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testAggregatesWithSameChangesAreEqual() { StopwatchSample sample = new StopwatchSample(); sample.setTotal(1); sample.setCounter(2); sample.setMin(3); sample.setMax(4); sample.setMinTimestamp(100); sample.setMaxTimestamp(200); sample.setActive(5); sample.setMaxActive(6); sample.setMaxActiveTimestamp(300); StopwatchAggregate otherAggregate = new StopwatchAggregate(); aggregate.addSample(sample); otherAggregate.addSample(sample); Assert.assertEquals(aggregate, otherAggregate); }