Spring Transactional Parameterized Test and Autowiring
Posted
by James Kingsbery
on Stack Overflow
See other posts from Stack Overflow
or by James Kingsbery
Published on 2010-03-23T19:08:54Z
Indexed on
2010/03/23
19:13 UTC
Read the original article
Hit count: 306
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 } }
© Stack Overflow or respective owner