testSubject.appendEvents("test", aggregate1.getUncommittedEvents());
assertEquals((long) aggregate1.getUncommittedEventCount(), mongoTemplate.domainEventCollection().count());
// we store some more events to make sure only correct events are retrieved
testSubject.appendEvents("test", aggregate2.getUncommittedEvents());
DomainEventStream events = testSubject.readEvents("test", aggregate1.getIdentifier());
List<DomainEventMessage> actualEvents = new ArrayList<DomainEventMessage>();
long expectedSequenceNumber = 0L;
while (events.hasNext()) {
DomainEventMessage event = events.next();
// Tests AXON-169
assertNotNull(event.getIdentifier());
actualEvents.add(event);
assertEquals("Events are read back in in the wrong order",
expectedSequenceNumber,