标签:style blog class c code java
/*package zxdc.web; import static org.junit.Assert.*; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import static org.easymock.EasyMock.*; import org.junit.After; import org.junit.Before; import org.junit.Test; import zyzy.common.util.Common; public class JunitEx { private Common servlet; private HttpServletRequest mockRequest; private HttpServletResponse mockResponse; public JunitEx(){ } @Before public void setUp()throws Exception{ servlet = new Common(); mockRequest = createMock(HttpServletRequest.class); mockResponse = createMock(HttpServletResponse.class); } @After public void tearDown()throws Exception{ verify(mockRequest); verify(mockResponse); } @Test public void testDoPostHttpServletRequestHttpServletResponse() throws ServletException, IOException { mockRequest.getParameter("id"); expectLastCall().andReturn("1"); replay(mockRequest); replay(mockResponse); servlet.doPost(mockRequest, mockResponse); } @Test public void xmlsql(){ String provinceid="12"; Common xmlCommon=new Common(); String resultString=xmlCommon.provinceIdEXprovinceCodeFromXml(provinceid); System.out.println(resultString); String expResult="0"; assertEquals(expResult,resultString); } @Test public void getHalfYearId(){ Common xmlCommon=new Common(); String resultString=xmlCommon.getHalfYearId(); String expResult="0"; System.out.println(resultString); //assertEquals(expResult,resultString); } } */
标签:style blog class c code java
原文地址:http://www.cnblogs.com/colmeluna/p/3739388.html