@Test void testLoadWithConflictingChanges_NoConflictResolverSet_UsingTooHighExpectedVersion() { String identifier = UUID.randomUUID().toString(); when(mockEventStore.readEvents(identifier)).thenReturn(DomainEventStream.of( new GenericDomainEventMessage<>("type", identifier, (long) 1, "Mock contents", emptyInstance()), new GenericDomainEventMessage<>("type", identifier, (long) 2, "Mock contents", emptyInstance()), new GenericDomainEventMessage<>("type", identifier, (long) 3, "Mock contents", emptyInstance()) )); try { testSubject.load(identifier, 100L); fail("Expected ConflictingAggregateVersionException"); } catch (ConflictingAggregateVersionException e) { assertEquals(identifier, e.getAggregateIdentifier()); assertEquals(100L, e.getExpectedVersion()); assertEquals(3L, e.getActualVersion()); } }
protected DomainEventStream readEvents(String aggregateIdentifier) { DomainEventStream fullStream = eventStore.readEvents(aggregateIdentifier); return eventStreamFilter != null ? fullStream.filter(eventStreamFilter) : fullStream; }
EventSourcingRepository extends LockingRepository<T, EventSourcedAggregate<T>> { protected DomainEventStream readEvents(String aggregateIdentifier) { DomainEventStream fullStream = eventStore.readEvents(aggregateIdentifier); return eventStreamFilter != null ? fullStream.filter(eventStreamFilter) : fullStream; } }
EventSourcingRepository extends LockingRepository<T, EventSourcedAggregate<T>> { protected DomainEventStream readEvents(String aggregateIdentifier) { DomainEventStream fullStream = eventStore.readEvents(aggregateIdentifier); return eventStreamFilter != null ? fullStream.filter(eventStreamFilter) : fullStream; } protected  EventSourcingRepository(Builder<T> builder); }
EventSourcingRepository extends LockingRepository<T, EventSourcedAggregate<T>> { protected DomainEventStream readEvents(String aggregateIdentifier) { DomainEventStream fullStream = eventStore.readEvents(aggregateIdentifier); return eventStreamFilter != null ? fullStream.filter(eventStreamFilter) : fullStream; } protected  EventSourcingRepository(Builder<T> builder); static Builder<T> builder(Class<T> aggregateType); AggregateFactory<T> getAggregateFactory(); }
EventSourcingRepository extends LockingRepository<T, EventSourcedAggregate<T>> { protected DomainEventStream readEvents(String aggregateIdentifier) { DomainEventStream fullStream = eventStore.readEvents(aggregateIdentifier); return eventStreamFilter != null ? fullStream.filter(eventStreamFilter) : fullStream; } protected  EventSourcingRepository(Builder<T> builder); static Builder<T> builder(Class<T> aggregateType); AggregateFactory<T> getAggregateFactory();  }