Spring JUnit4

使用Spring的测试框架需要加入以下依赖包:

JUnit4,

Springtest包

Spring相关其他依赖包

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { 
		"classpath:applicationContext.xml",
		"classpath:com/test/spring-context-trans.xml" })

public class TransDaoTest {
	private static final Log log = LogFactory.getLog(TransDaoTest.class);

	@Autowired
	TransDao transDao;
	

	@Test
	public void test(){
		List<ConfLanguage> list= transDao.findLangsByCode("BOK");
		Assert.assertEquals(1,list.size());
	}
	
}

相关推荐