We have a large number of unit/integration tests that assert behavior within our system and rely upon injection of dependencies into configurable domain objects.
These tests all work when executed individually; however, when executed within a suite (either through the IDE or Ant) certain tests fail as dependencies have not been injected into the @Configurable objects. We have also seen dependencies that were configured for test X being injected into test Y rather than the dependencies for test Y; but I have no test case for this.
I have created a set of three tests – tests 1 and 3 are basically identical. If these are executed in a suite the third test will fail as the dependency is not injected into the @Configurable object even though it is available to the test. This only occurs if test 2 is a Spring test.
See attached zip file.
- Spring Test Context Caching + AspectJ @Transactional + Ehcache pain blog by Java Code Geeks