I want to create a unit test for integration testing. What class should I inherit to be able to commit/rollback transactions? AbstractTransactionalSpringContextTests
is deprecated. It's recommended to use AbstractJUnit38SpringContextTests
instead, but I cannot find how to control transactions there.
views:
95answers:
1
+3
A:
Check this and this
In short, you need:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:/applicationContext.xml")
public class YourTest {
@Transactional
public void someTest() {
}
}
That would mean you need JUnit 4.x
Bozho
2010-02-18 14:37:02