Problems with Test fixture


Currently I'm facing problems with the test fixture. I have a fixture configuration which registers some injectable resources. However if a spring context is loaded the real resources gets injected instead of the mocked resources which I registered in the fixture configuration using the registerInjectableResource method.

When I run only the single test (for the command that needs an injected resource) it works just fine (there is no spring context)
However, when I run all my tests it fails because the real resource is injected instead of the mocked one.. (there is a spring context which was started by another test class to check whether my spring configuration is configured properly)

I'm using axon 2.0.1

It would be nice to have my mocked resource injected instead of the real one. This makes my test a little more predictable and much easier to control :wink:


The plot thickens..

It is apparently a problem caused by IntelliJ.. When I run the tests from the command line everything works just fine. When I run the tests from IntelliJ I experience the strange behavior described below.

If I set the fork mode to class when running my tests everything works just fine but running my entire test suite takes ages..

Does someone have any idea what could cause my problems?




I have reopened issue AXON-100, which deals with this problem. Apparently, it hasn’t been resolved for all cases.

The issue also provided a workaround that might help if you can’t wait for the fix. I’ll do my best to solve it soon.

For details, see