在Spring Framework 3的单元测试中,针对数据库单元测试,我们一般会采用“@Rollback(true)”进行回滚,如下:
@RunWith(SpringJUnit4ClassRunner.class)
// 引入Spring配置文件
@ContextConfiguration(locations = { "classpath:/META-INF/springContext/service-context.xml" })
public class EmailActionServiceTest {
@Test
@Rollback(true)
public void testSave() {
assertThat(actionService, IsNull.notNullValue());
// 示例代码
Emai