Spring Transactional Parameterized Test and Autowiring
- by James Kingsbery
Is there a way to get a class that extends AbstractTransactionalJUnit4SpringContexts to play nicely with JUnit's own @RunWith(Parameterized), so that fields marked as Autowired get wired in properly?
@RunWith(Parameterized)
public class Foo extends AbstractTransactionalJUnit4SpringContexts {
@Autowired private Bar bar
@Parameters public static Collection data() {
// return parameters, following pattern in
// http://junit.org/apidocs/org/junit/runners/Parameterized.html
}
@Test public void someTest(){
bar.baz() //NullPointerException
}
}