@Test void testSequentialIdentifier() { SequentialPerAggregatePolicy testSubject = new SequentialPerAggregatePolicy(); String aggregateIdentifier = UUID.randomUUID().toString(); Object id1 = testSubject.getSequenceIdentifierFor(newStubDomainEvent(aggregateIdentifier)); Object id2 = testSubject.getSequenceIdentifierFor(newStubDomainEvent(aggregateIdentifier)); Object id3 = testSubject.getSequenceIdentifierFor(newStubDomainEvent(UUID.randomUUID().toString())); Object id4 = testSubject.getSequenceIdentifierFor(new GenericEventMessage<>("bla")); assertEquals(id1, id2); assertNotEquals(id1, id3); assertNotEquals(id2, id3); assertNull(id4); }
@Override public Object getSequenceIdentifierFor(EventMessage event) { if (event instanceof DomainEventMessage) { return ((DomainEventMessage) event).getAggregateIdentifier(); } return null; }
SequentialPerAggregatePolicy implements SequencingPolicy<EventMessage> { @Override public Object getSequenceIdentifierFor(EventMessage event) { if (event instanceof DomainEventMessage) { return ((DomainEventMessage) event).getAggregateIdentifier(); } return null; } }
SequentialPerAggregatePolicy implements SequencingPolicy<EventMessage> { @Override public Object getSequenceIdentifierFor(EventMessage event) { if (event instanceof DomainEventMessage) { return ((DomainEventMessage) event).getAggregateIdentifier(); } return null; }  }
SequentialPerAggregatePolicy implements SequencingPolicy<EventMessage> { @Override public Object getSequenceIdentifierFor(EventMessage event) { if (event instanceof DomainEventMessage) { return ((DomainEventMessage) event).getAggregateIdentifier(); } return null; }  static SequentialPerAggregatePolicy instance(); @Override Object getSequenceIdentifierFor(EventMessage event); }
SequentialPerAggregatePolicy implements SequencingPolicy<EventMessage> { @Override public Object getSequenceIdentifierFor(EventMessage event) { if (event instanceof DomainEventMessage) { return ((DomainEventMessage) event).getAggregateIdentifier(); } return null; }  static SequentialPerAggregatePolicy instance(); @Override Object getSequenceIdentifierFor(EventMessage event);  }