logictagswebtestcase.java

来自「webwork source」· Java 代码 · 共 62 行

JAVA
62
字号
/* * WebWork, Web Application Framework * * Distributable under Apache license. * See terms of license at opensource.org */package webwork.view.taglib;import junit.textui.TestRunner;import org.xml.sax.SAXException;import com.meterware.httpunit.GetMethodWebRequest;import com.meterware.httpunit.WebConversation;import com.meterware.httpunit.WebRequest;import com.meterware.httpunit.WebResponse;import com.meterware.httpunit.WebTable;import webwork.view.WebSupport;/** * @author Maurice C. Parker (maurice@vineyardenterprise.com) */public class LogicTagsWebTestCase extends WebSupport {	public LogicTagsWebTestCase(String testName) {		super(testName);	}	public void testIfTags() {		WebConversation conversation = new WebConversation();		WebRequest request = new GetMethodWebRequest(TEST_HOME + "tests/expr.jsp");		WebResponse response = null;		try {			response = conversation.getResponse(request);		} catch (Exception e) {			fail(e);		}		WebTable table = null;		try {			table = response.getTables()[0];		} catch (SAXException e) {			fail(e);		}		for (int i = 1; i < table.getRowCount(); i++) {			if (table.asText()[i][3].equals("X")) {				assertEquals("test " + i + " failed", 0, table.asText()[i][2].trim().length());			} else {				assertEquals("test " + i + " failed", "Success", table.asText()[i][2].trim());			}		}	}	public static void main(String[] args) {		TestRunner.run(LogicTagsWebTestCase.class);	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?