Hi.
I have a saga that looks similar to:
@Saga(sagaStore = "mySagaStore")
public class ValidateAndRequestTranslationsForModifiedRecordDataSaga {
private Set<RecordData> changedRecords = new HashSet<>();
@StartSaga
@SagaEventHandler(associationProperty = "uniqueId")
public void on(RecordDataCreatedEvent event) {
changedRecords.addAll(event.createdData());
}
@StartSaga
@SagaEventHandler(associationProperty = "uniqueId")
public void on(RecordDataUpdatedEvent event) {
changedRecords.addAll(event.updatedData());
}
@EndSaga
@SagaEventHandler(associationProperty = "uniqueId")
public void on(RecordModifiedEvent event) throws JsonProcessingException {
// act on the changed records and do something
}
}
How can I use the saga fixture to test what happens when the RecordModifiedEvent
is issued.
In the documentation you see examples like:
fixture.givenNoPriorActivity()
.whenAggregate(event.uniqueId())
.publishes(aRecordModifiedEvent)
.expectActiveSagas(1)
.expectAssociationWith("uniqueId", event.uniqueId());
But I need my saga to be pre-filled with changed records before I test the record modified event.
Did I miss something or am I thinking incorrectly?