Hi all,
I’m having some trouble with the GivenWhenThenTestFixture – it seems that in some cases no matter what I do, I get the “stored events and published events do not match” error where some events are missing in the “published” list. (Not different, just missing.)
After a lot of old-school logging-based debugging I finally tracked this down to the following bit of code:
public DomainEventMessage onRegisteredEvent(DomainEventMessage event) {
if (registeredAggregates.containsKey(aggregate)) {
event = (DomainEventMessage) invokeEventRegistrationListeners(event);
doPublish(event, eventBus);
}
return event;
}
in DefaultUnitOfWork. Removing the “registeredAggregates.containsKey(…)” check makes everything the event “published” and “stored” lists match.
Does anybody have any hints as to why the check is there and perhaps what’s going on?
I don’t think I’m doing anything strange which would cause the aggregate to not be registered with the unit of work.