ResultValidator#expectEvents() doesn't report exceptions when called without arguments


I have a number of (Axon 2) tests in the form

fixture.given(event, event, …).when(command).expectEvents()

(I expect zero events)

I found out that some of the tests pass just because an exception is thrown somewhere during command handling, stopping all further computation. The expectEvents() method, when called without arguments, doesn’t report the exception but simply states that the published events are exactly as expected.

Is this behavior intended? I find it confusing, and It makes me feel less confident about all my successful tests. Of is there a better idiom that I should use?

Hi Gianluca,

in fact, this is intended. When you get an exception that rolls back the uow, you publish no events. However, if you expect no events and a normal execution, you can also assert that using assertReturnValue(…) or assertVoidReturnValue().