Aggregate extends CommandHandlingEntity<I, S, B> implements EventPlayer, EventReactor { final void setEventCountAfterLastSnapshot(int count) { checkArgument(count >= 0, "Event count cannot be negative."); this.eventCountAfterLastSnapshot = count; } protected  Aggregate(); protected  Aggregate(I id); @Override final BatchDispatchOutcome play(Iterable<Event> events);  }
@Test @DisplayName("not allow a negative event count after last snapshot") void negativeEventCount() { Aggregate<?, ?, ?> aggregate = this.aggregate; assertThrows(IllegalArgumentException.class, () -> aggregate.setEventCountAfterLastSnapshot(-1)); }