@Test void testNullSequenceNumberFromDelegates_NullPointer() { DomainEventStream concat = new ConcatenatingDomainEventStream( DomainEventStream.of(event1), DomainEventStream.of(Stream.empty(), () -> null)); assertEquals(event1.getSequenceNumber(), concat.getLastSequenceNumber()); }
@Override public Long getLastSequenceNumber() { return Stream.concat(consumedStreams.stream(), streams.stream()) .map(DomainEventStream::getLastSequenceNumber) .filter(x -> !Objects.isNull(x)) .reduce(Math::max) .orElse(null); }
ConcatenatingDomainEventStream implements DomainEventStream { @Override public Long getLastSequenceNumber() { return Stream.concat(consumedStreams.stream(), streams.stream()) .map(DomainEventStream::getLastSequenceNumber) .filter(x -> !Objects.isNull(x)) .reduce(Math::max) .orElse(null); } }
ConcatenatingDomainEventStream implements DomainEventStream { @Override public Long getLastSequenceNumber() { return Stream.concat(consumedStreams.stream(), streams.stream()) .map(DomainEventStream::getLastSequenceNumber) .filter(x -> !Objects.isNull(x)) .reduce(Math::max) .orElse(null); } ConcatenatingDomainEventStream(DomainEventStream... streams);  ConcatenatingDomainEventStream(Collection<DomainEventStream> streams); }
ConcatenatingDomainEventStream implements DomainEventStream { @Override public Long getLastSequenceNumber() { return Stream.concat(consumedStreams.stream(), streams.stream()) .map(DomainEventStream::getLastSequenceNumber) .filter(x -> !Objects.isNull(x)) .reduce(Math::max) .orElse(null); } ConcatenatingDomainEventStream(DomainEventStream... streams);  ConcatenatingDomainEventStream(Collection<DomainEventStream> streams); @Override DomainEventMessage<?> peek(); @Override boolean hasNext(); @Override DomainEventMessage<?> next(); @Override Long getLastSequenceNumber(); }
ConcatenatingDomainEventStream implements DomainEventStream { @Override public Long getLastSequenceNumber() { return Stream.concat(consumedStreams.stream(), streams.stream()) .map(DomainEventStream::getLastSequenceNumber) .filter(x -> !Objects.isNull(x)) .reduce(Math::max) .orElse(null); } ConcatenatingDomainEventStream(DomainEventStream... streams);  ConcatenatingDomainEventStream(Collection<DomainEventStream> streams); @Override DomainEventMessage<?> peek(); @Override boolean hasNext(); @Override DomainEventMessage<?> next(); @Override Long getLastSequenceNumber();  }