}
@Test
public void testCounterResetWhenCacheRemovesEntry() {
testSubject.setAggregateCaches(Arrays.<Cache>asList(mockCache));
readAllFrom(testSubject.decorateForRead("some", aggregateIdentifier, new SimpleDomainEventStream(
new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 0,
"Mock contents", MetaData.emptyInstance()),
new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 1,
"Mock contents", MetaData.emptyInstance())
)));
readAllFrom(testSubject.decorateForAppend("some", aggregate, new SimpleDomainEventStream(
new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 2,
"Mock contents", MetaData.emptyInstance())
)));
final Cache.EntryListener listener = listenerConfiguration.getLastValue();
listener.onEntryRemoved(aggregateIdentifier);
readAllFrom(testSubject.decorateForAppend("some", aggregate, new SimpleDomainEventStream(
new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 3,
"Mock contents", MetaData.emptyInstance())
)));
verify(mockSnapshotter, never()).scheduleSnapshot("some", aggregateIdentifier);