Welcome to the forum, @Dimitar!
Let’s dive into your scenario right away.
The shouldNotRunSameCommand() test case you’ve written makes an assumption about the Test Fixtures that isn’t correct I am afraid.
The AggregateTestFixture is intended to validate the behavior of a single Aggregate type and instance in action.
The test case you’ve written assumes that the scanCommand is ignored because the aggregate constructed out of the scanReceivedEvent already exists.
You would make the test run successfully if the @CommandHandler annotated method is a none-constructor command handler with the @CreationPolicy(CREATE_IF_MISSING) annotation attached to it.
By doing so, you more clearly signal Axon Framework that you want the command handler to check for aggregate uniqueness based on the aggregate identifier.
Differently put, the Test Fixture cannot correlate your given event with the “new” command, as they seem unrelated to it.
Granted, I do have two remarks:
I don’t think that the EventStoreException you get to be very clear. We could improve in that area.
I find it pretty odd that your test fails in 4.10.0 but succeeds in 4.10.1… I have been checking the release notes of 4.10.1 and commit history of the AggregateTestFixture, but can’t find any clear reasoning why you’ve spotted this behavior.
At any rate, I do believe you have an answer for what to do. If you feel like investigating the scenario that it works for 4.10.1 but doesn’t for 4.10.0, I would gladly hear your future findings!
When I thought about it, my check in event sourcing handler is also useless, as duplicate constructor invocation should result in some kind of an exception.
Other than that, different behavior in different versions seems to be the only issue.