@Test void testDetectConflicts() { subject = new DefaultConflictResolver(eventStore, AGGREGATE, 5, 9); assertThrows( ConflictingModificationException.class, () -> subject.detectConflicts(Conflicts.payloadTypeOf(String.class))); }
@Override public <T extends Exception> void detectConflicts(Predicate<List<DomainEventMessage<?>>> predicate, ContextAwareConflictExceptionSupplier<T> exceptionSupplier) throws T { conflictsResolved = true; List<DomainEventMessage<?>> unexpectedEvents = unexpectedEvents(); if (predicate.test(unexpectedEvents)) { T exception = exceptionSupplier.supplyException(new DefaultConflictDescription(aggregateIdentifier, expectedVersion, actualVersion, unexpectedEvents)); if (exception != null) { throw exception; } } }
DefaultConflictResolver implements ConflictResolver { @Override public <T extends Exception> void detectConflicts(Predicate<List<DomainEventMessage<?>>> predicate, ContextAwareConflictExceptionSupplier<T> exceptionSupplier) throws T { conflictsResolved = true; List<DomainEventMessage<?>> unexpectedEvents = unexpectedEvents(); if (predicate.test(unexpectedEvents)) { T exception = exceptionSupplier.supplyException(new DefaultConflictDescription(aggregateIdentifier, expectedVersion, actualVersion, unexpectedEvents)); if (exception != null) { throw exception; } } } }
DefaultConflictResolver implements ConflictResolver { @Override public <T extends Exception> void detectConflicts(Predicate<List<DomainEventMessage<?>>> predicate, ContextAwareConflictExceptionSupplier<T> exceptionSupplier) throws T { conflictsResolved = true; List<DomainEventMessage<?>> unexpectedEvents = unexpectedEvents(); if (predicate.test(unexpectedEvents)) { T exception = exceptionSupplier.supplyException(new DefaultConflictDescription(aggregateIdentifier, expectedVersion, actualVersion, unexpectedEvents)); if (exception != null) { throw exception; } } } DefaultConflictResolver(EventStore eventStore, String aggregateIdentifier, long expectedVersion,
                                   long actualVersion); }
DefaultConflictResolver implements ConflictResolver { @Override public <T extends Exception> void detectConflicts(Predicate<List<DomainEventMessage<?>>> predicate, ContextAwareConflictExceptionSupplier<T> exceptionSupplier) throws T { conflictsResolved = true; List<DomainEventMessage<?>> unexpectedEvents = unexpectedEvents(); if (predicate.test(unexpectedEvents)) { T exception = exceptionSupplier.supplyException(new DefaultConflictDescription(aggregateIdentifier, expectedVersion, actualVersion, unexpectedEvents)); if (exception != null) { throw exception; } } } DefaultConflictResolver(EventStore eventStore, String aggregateIdentifier, long expectedVersion,
                                   long actualVersion); @Override void detectConflicts(Predicate<List<DomainEventMessage<?>>> predicate, ContextAwareConflictExceptionSupplier<T> exceptionSupplier); void ensureConflictsResolved(); }
DefaultConflictResolver implements ConflictResolver { @Override public <T extends Exception> void detectConflicts(Predicate<List<DomainEventMessage<?>>> predicate, ContextAwareConflictExceptionSupplier<T> exceptionSupplier) throws T { conflictsResolved = true; List<DomainEventMessage<?>> unexpectedEvents = unexpectedEvents(); if (predicate.test(unexpectedEvents)) { T exception = exceptionSupplier.supplyException(new DefaultConflictDescription(aggregateIdentifier, expectedVersion, actualVersion, unexpectedEvents)); if (exception != null) { throw exception; } } } DefaultConflictResolver(EventStore eventStore, String aggregateIdentifier, long expectedVersion,
                                   long actualVersion); @Override void detectConflicts(Predicate<List<DomainEventMessage<?>>> predicate, ContextAwareConflictExceptionSupplier<T> exceptionSupplier); void ensureConflictsResolved();  }