@Test public void testDispatchInterceptorOnAggregate() { configuration.deadlineManager().registerDispatchInterceptor(messages -> (i, m) -> GenericDeadlineMessage.asDeadlineMessage(m.getDeadlineName(), new DeadlinePayload("fakeId"))); configuration.commandGateway().sendAndWait(new CreateMyAggregateCommand(IDENTIFIER)); assertPublishedEvents(new MyAggregateCreatedEvent(IDENTIFIER), new DeadlineOccurredEvent(new DeadlinePayload("fakeId"))); }
@Test public void testDispatchInterceptorOnSaga() { EventMessage<Object> testEventMessage = asEventMessage(new SagaStartingEvent(IDENTIFIER, DO_NOT_CANCEL_BEFORE_DEADLINE)); configuration.deadlineManager().registerDispatchInterceptor(messages -> (i, m) -> GenericDeadlineMessage.asDeadlineMessage(m.getDeadlineName(), new DeadlinePayload("fakeId"))); configuration.eventStore().publish(testEventMessage); assertPublishedEvents(new SagaStartingEvent(IDENTIFIER, DO_NOT_CANCEL_BEFORE_DEADLINE), new DeadlineOccurredEvent(new DeadlinePayload("fakeId"))); }