Skip to content

Instantly share code, notes, and snippets.

@yongchun
Last active January 1, 2016 12:49
Show Gist options
  • Save yongchun/8146816 to your computer and use it in GitHub Desktop.
Save yongchun/8146816 to your computer and use it in GitHub Desktop.
tentng+jmock的单元测试
import org.mockito.MockitoAnnotations;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;
import org.testng.annotations.BeforeClass;
@ContextConfiguration({
"classpath:spring-dao.xml",
"classpath:spring-config.xml",
"classpath:spring-dataSource.xml"
})
@Transactional
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
//@RunWith(MockitoJUnitRunner.class)
public class BaseTest extends AbstractTestNGSpringContextTests{
@BeforeClass
public void initMocks() {
MockitoAnnotations.initMocks(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment