Testing a @ExceptionHandler with a Saga

I don’t have a definitive answer with example code.

But if you check the docs for the saga test fixture (https://apidocs.axoniq.io/4.4/org/axonframework/test/saga/SagaTestFixture.html) and search for “exception” you will find the following method:

registerListenerInvocationErrorHandler(ListenerInvocationErrorHandler listenerInvocationErrorHandler)

Which is described as:

Registers a ListenerInvocationErrorHandler to be set for the Saga to deal with exceptions being thrown from within Saga Event Handlers.

You may find this method useful (or check the docs for an alternative method which may suit you better).