JUnit parameterized test with Spring autowiring AND transactions
I've been writing JUnit Parameterized tests (a nice intro here - also see Theories ) to do some data driven API testing. Now, when introducing Spring into the mix there are a couple of extra things to do . I came unstuck though because I was trying to do Transactional tests - since I'm now using @RunWith(Parameterized.class) and setting up my Spring TestContextManager manually the @Transaction annotations caused an exception: java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given I couldn't find any built in solution, so I've gone with manual transaction management in my test, using doInTransaction: @RunWith(Parameterized.class) @ContextConfiguration(locations = "classpath*:/testContext.xml") public class MyTest { @Autowired PlatformTransactionManager transactionManager; private TestContextManager testContextManager; public MyTest (... parameters for test) { // store parameters in instance v...