Between myself and Dzmitry Kazimirchyk we just finished a huge project of 
converting our unit tests to the DI container. We have a much cleaner test 
system as a result:

* No more verbose XML files for data sets.
* No more Spring XML configuration.
* Injection into test cases of pretty much anything. This means much less bloat 
in the tests, so the actual assertions are easy to see and understand.
* Real inversion of control - now it is possible to build test classes (or 
common superclasses) based on a very specific DI configuration. For now we have 
2 such configs - ClientCaseModule and ServerCaseModule plus a few adhoc ones.
* DI container provides correct resource scoping. The only thing in the global 
scope is DB schema drop/create. The rest (including instantiation of Cayenne 
stacks) is in per-test-method scope. This means that tests can freely alter 
DataMaps, etc. without having to worry about resetting them back.

I may still do some refactoring of the DI code, but the main thing is there. 

Andrus

Reply via email to