testNGテストトランザクションロールバック


詳細
/**
* 
*/
@ContextConfiguration("classpath:/config/applicationContext.xml")
public class CollegeMapperTest extends AbstractTransactionalTestNGSpringContextTests{

    @Resource
    private CollegeMapper collegeMapper;
    @Test
    public void testInsertReject() throws Exception {
        Reject reject = new Reject(1,null,"XXX");
        collegeMapper.insertReject(reject);
    }
}

/**
* 
*/
@ContextConfiguration("classpath:/config/applicationContext.xml")
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = false)
public class CollegeMapperTest extends AbstractTestNGSpringContextTests{

    @Resource
    private CollegeMapper collegeMapper;

    @Rollback(true)
    @Test
    public void testInsertReject() throws Exception {
        Reject reject = new Reject(1,null,"XXXX");
        collegeMapper.insertReject(reject);
    }
}