Hi, I've been testing some things with regard to the CREATE_IF_MISSING aggregate feature. I've been trying several things in a running Spring boot application+dockerized Axon server and all works well, however I can not get the unittests to work when using the AggregateTestFixture.
The aggregate only has a default public constructor. This is the only commandhandler:
@CommandHandler
@CreationPolicy(AggregateCreationPolicy.CREATE_IF_MISSING)
public void handle(ImportOrganisationCommand cmd) {
if (id == null) {
apply(new OrganisationCreatedEvent(cmd.getOrganisation()));
} else if (!cmd.getOrganisation().equals(organisation)) {
apply(new OrganisationUpdatedEvent(cmd.getOrganisation()));
}
}
This is the test:
@Test
void test1() {
ImportOrganisationCommand cmd = new ImportOrganisationCommand("1", org1);
OrganisationCreatedEvent organisationCreatedEvent = new OrganisationCreatedEvent(org1);
testFixture.givenNoPriorActivity()
.when(cmd)
.expectEvents(organisationCreatedEvent);
}
which results in the following error:
org.axonframework.common.AxonConfigurationException: Identifier must be set after handling the message
I do not understand what the problem is ?