package com.hxh.spring.test; import com.yeshi.buwan.dao.HomeVideoDao; import com.yeshi.buwan.domain.HomeType; import com.yeshi.buwan.domain.HomeVideo; import com.yeshi.buwan.service.imp.HomeTypeService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import javax.annotation.Resource; import java.util.List; @RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试 @ContextConfiguration(locations = {"classpath:spring.xml"}) @WebAppConfiguration public class HomeTypeTest { @Resource private HomeTypeService homeTypeService; @Resource private HomeVideoDao homeVideoDao; @Test public void addTest() { List homeTypeList = homeTypeService.getHomeTypeList("44", 109, "recommend", 1, 4); for (int i = 0; i < homeTypeList.size(); i++) { // List homeVideoList = homeTypeService.getHomeVideoList() } long count = homeTypeService.countHomeType("44", 109, "recommend"); System.out.println(count); } @Test public void testHomeVideo() { HomeVideo homeVideo = homeVideoDao.find(HomeVideo.class, "47628"); System.out.println(homeVideo); } }