Hi,
I have a Saga that executes a command in the saga's EndSaga handler. It looks like this (Not actual code, just similar).
public class ScheduleEmailSaga extends AbstractAnnotatedSaga {
private EmailAddress emailAddress;
CommandGateway gateway;
public ScheduleEmailSaga() {
}
public ScheduleEmailSaga(CommandGateway gateway) {
this.gateway = gateway;
}
@StartSaga
public void on(EmailCreatedEvent event) {
this.associateWith("accountEmail", event.getEmailAddress());
}
@EndSaga
public void on(EmailVerifiedEvent event) {
this.gateway.executeAsync(new ScheduleWelcomeEmailCommand(event.getEmailAddress()));
}
}
I am trying to test this interaction using an AnnotatedSagaTestFixture, but could not find any way to inject the CommandGateway instance in to the saga under test. The AnnotatedSagaTestFixture can construct the saga only with the default no-argument constructor.
What approach should I take here?
Thank you.
Sadique Ali