### Question:
AggregateReader { public void readEvents(String aggregateId, boolean useSnapshots, long minSequenceNumber, Consumer<SerializedEvent> eventConsumer) { readEvents(aggregateId, useSnapshots, minSequenceNumber, Long.MAX_VALUE, 0, eventConsumer); } AggregateReader(EventStorageEngine eventStorageEngine, SnapshotReader snapshotReader); void readEvents(String aggregateId, boolean useSnapshots, long minSequenceNumber,
                           Consumer<SerializedEvent> eventConsumer); void readEvents(String aggregateId, boolean useSnapshots, long minSequenceNumber, long maxSequenceNumber,
                           long minToken,
                           Consumer<SerializedEvent> eventConsumer); void readSnapshots(String aggregateId, long minSequenceNumber, long maxSequenceNumber, int maxResults,
                              Consumer<SerializedEvent> eventConsumer); long readHighestSequenceNr(String aggregateId); long readHighestSequenceNr(String aggregateId, int maxSegmentsHint, long maxTokenHint);  }### Answer:
@Test public void readEventsFromOldSegment() { AtomicLong sequenceNumber = new AtomicLong(); testSubject.readEvents("1", true, 0, event -> sequenceNumber.set(event.getAggregateSequenceNumber())); Assert.assertEquals(99, sequenceNumber.intValue()); }
@Test public void readEventsFromCurrentSegment() { AtomicLong sequenceNumber = new AtomicLong(); testSubject.readEvents("999", true, 0, event -> sequenceNumber.set(event.getAggregateSequenceNumber())); Assert.assertEquals(99, sequenceNumber.intValue()); }
@Test public void readEventsWithSnapshot() { List<Event> events = new ArrayList<>(); testSubject.readEvents("55", true, 0, event -> { events.add(event.asEvent()); }); Assert.assertEquals(25, events.size()); Assert.assertEquals("Snapshot", events.get(0).getAggregateType()); }
@Test public void readEventsWithSnapshotBeforeMin() { List<Event> events = new ArrayList<>(); testSubject.readEvents("55", true, 90, event -> { events.add(event.asEvent()); }); Assert.assertEquals(10, events.size()); Assert.assertEquals("Demo", events.get(0).getAggregateType()); }