单元测试
- 导入junit4和spring-test.jar包。
2.使用@ContextConfiguration引入spring配置文件
例如:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:applicationContext.xml"})
public class ReadDaoImplTest {
@Resource
ReadDao readDao;
@Test
public void getListTest(){
List<Client> clientList = readDao.getList("client.test", null);
for(Client c:clientList){
System.out.println(c.getVersionNum());
}
}
}