import java.util.List;
import javax.sql.DataSource;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
import com.japdplat.modules.sites.dao.TVideoDao;
import com.japdplat.modules.sites.dao.TypeDao;
import com.japdplat.modules.sites.entity.TVideo;
import com.japdplat.modules.sites.entity.Type;
import com.japdplat.modules.sites.service.TVideoService;
/**
* Spring 单元测试基类
* @author LzwGlory
* @version 2013-12-17
*/
@ActiveProfiles("production")
@ContextConfiguration(locations = {"/applicationContext.xml"})
public class SpringTransactionalContextTests extends AbstractTransactionalJUnit4SpringContextTests {
protected DataSource dataSource;
@Autowired
protected TVideoDao tvideoDao;
@Autowired
public void setDataSource(DataSource dataSource) {
super.setDataSource(dataSource);
this.dataSource = dataSource;
}
@Test
public void save4(){
List<TVideo> list=tvideoDao.getAll(1L);
System.out.println(list);
System.out.println(list.size());
}
}
spring 单元测试
最新推荐文章于 2021-08-17 10:56:35 发布