junit測試SSH基本環境

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ExampleTest {

public static BeanFactory beanFactory = null;
	
	@BeforeClass
	public static void classSetUp(){
		beanFactory = new ClassPathXmlApplicationContext("file:E:\\eclipseWorkspace\\gdzzjob\\WebRoot\\WEB-INF\\applicationContext.xml");
	}
	
	@Before
	public void setUp() throws Exception {
		beanFactory = new ClassPathXmlApplicationContext("file:E:\\eclipseWorkspace\\gdzzjob\\WebRoot\\WEB-INF\\applicationContext.xml");
	}
	
	@Test
	public void testIndexContent1(){
		//IndexAction action = new IndexAction();
		//action.commonservice = mock(CommonService.class);
		//action.commonservice = (CommonService)beanFactory.getBean("commonServices");
		//action.currentPage = 1;
		//action.pageSize=5;
		//String result = action.indexContent();
		//Assert.assertEquals("success", result);
	}

}
相關文章
相關標籤/搜索