### Question:
CounterAggregate { void addSample(CounterSample sample) { counter += sample.getCounter(); incrementSum += sample.getIncrementSum(); decrementSum += sample.getDecrementSum(); if (min > sample.getMin()) { min = sample.getMin(); minTimestamp = sample.getMinTimestamp(); } if (max < sample.getMax()) { max = sample.getMax(); maxTimestamp = sample.getMaxTimestamp(); } } CounterAggregate(); long getCounter(); long getIncrementSum(); long getDecrementSum(); long getMax(); long getMaxTimestamp(); long getMin(); long getMinTimestamp(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testAggregatesWithSameChangesAreEqual() { CounterSample sample = new CounterSample(); sample.setCounter(8); sample.setIncrementSum(10); sample.setDecrementSum(2); sample.setMin(-2); sample.setMax(10); sample.setMinTimestamp(100); sample.setMaxTimestamp(200); CounterAggregate otherAggregate = new CounterAggregate(); counterAggregate.addSample(sample); otherAggregate.addSample(sample); Assert.assertEquals(counterAggregate, otherAggregate); }