Closed GoogleCodeExporter closed 8 years ago
Hi,
Did you checked what is null at line 75 from your DAO ? To be sure it's
relative to
the transactional listener...
java.lang.NullPointerException
at foo.DataDaoTest.testSaveData(DataDaoTest.java:75)
As i can see for now, beforeTest and afterTest methods of TestContextManager
are not
called. This won't be hard to fix it: I'll try to fix it quickly.
Original comment by mathieu....@gmail.com
on 3 Dec 2009 at 7:45
Original comment by mathieu....@gmail.com
on 3 Dec 2009 at 7:46
Original comment by mathieu....@gmail.com
on 3 Dec 2009 at 7:46
Issue fixed in svn, will deploy release 2.3 this evening
Original comment by mathieu....@gmail.com
on 3 Dec 2009 at 9:42
This version is available in Maven 2 central repository and contains:
* A fix for Spring Plugin: Spring Test Listeners where not invoked correctly
for each
test method
Here is an example of test using @Transactional:
@RunWith(MycilaJunitRunner.class)
@SpringContext(locations = "/ctx-tx.xml")
@TransactionConfiguration(transactionManager = "myTransactionManager")
public class SpringTxTest {
@Autowired
Dao dao;
@Test
@Transactional
public void test() {
dao.save();
}
}
* The name attribute of @Bean annotation is now optional. If not provided, the
name
of the field or method is used.
@Bean
String abean = "helloa";
* Spring Java config is now supported in @SpringContext annotation through the
classes attribute:
@RunWith(MycilaJunitRunner.class)
@SpringContext(locations = "/ctx-autowired2.xml", classes = MyJavaConfig.class)
@TransactionConfiguration(transactionManager = "myTransactionManager")
public class SpringJavaConfigTest {
@Autowired
Dao dao;
@Autowired
Autowired2Bean autowired2Bean;
@Test
@Transactional
public void test() {
assertNotNull(dao);
assertNotNull(autowired2Bean);
assertNotNull(autowired2Bean.dao);
dao.save();
}
}
Original comment by mathieu....@gmail.com
on 4 Dec 2009 at 3:19
Original issue reported on code.google.com by
jmcg...@gmail.com
on 3 Dec 2009 at 7:10