You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by jm...@apache.org on 2003/03/07 06:40:38 UTC
cvs commit: jakarta-struts/web/test/test/org/apache/struts/taglib/html TestHiddenTag1.jsp TestHiddenTag2.jsp
jmitchell 2003/03/06 21:40:38
Added: src/test/org/apache/struts/taglib/html TestHiddenTag1.java
TestHiddenTag2.java
web/test/test/org/apache/struts/taglib/html
TestHiddenTag1.jsp TestHiddenTag2.jsp
Log:
Adding more tests
Revision Changes Path
1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestHiddenTag1.java
Index: TestHiddenTag1.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Struts", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.struts.taglib.html;
import java.util.Locale;
import javax.servlet.jsp.PageContext;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.cactus.JspTestCase;
import org.apache.struts.Globals;
import org.apache.struts.taglib.SimpleBeanForTesting;
/**
* Suite of unit tests for the
* <code>org.apache.struts.taglib.bean.HiddenTag</code> class.
*
* @author James Mitchell
*/
public class TestHiddenTag1 extends JspTestCase {
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestHiddenTag1(String theName) {
super(theName);
}
/**
* Start the tests.
*
* @param theArgs the arguments. Not used
*/
public static void main(String[] theArgs) {
junit.awtui.TestRunner.main(new String[] {TestHiddenTag1.class.getName()});
}
/**
* @return a test suite (<code>TestSuite</code>) that includes all methods
* starting with "test"
*/
public static Test suite() {
// All methods starting with "test" will be executed in the test suite.
return new TestSuite(TestHiddenTag1.class);
}
private void runMyTest(String whichTest, String locale){
pageContext.setAttribute(Globals.LOCALE_KEY, new Locale(locale, locale), PageContext.SESSION_SCOPE);
pageContext.setAttribute(Constants.BEAN_KEY, new SimpleBeanForTesting("Test Value"), PageContext.REQUEST_SCOPE);
request.setAttribute("runTest", whichTest);
try {
pageContext.forward("/test/org/apache/struts/taglib/html/TestHiddenTag1.jsp");
}
catch (Exception e) {
e.printStackTrace();
fail("There is a problem that is preventing the tests to continue!");
}
}
/*
* Testing HiddenTag.
*/
public void testHiddenProperty(){
runMyTest("testHiddenProperty", "");
}
public void testHiddenPropertyAccesskey(){
runMyTest("testHiddenPropertyAccesskey", "");
}
public void testHiddenPropertyAlt(){
runMyTest("testHiddenPropertyAlt", "");
}
public void testHiddenPropertyAltKey1(){
runMyTest("testHiddenPropertyAltKey1", "");
}
public void testHiddenPropertyAltKey2(){
runMyTest("testHiddenPropertyAltKey2", "");
}
public void testHiddenPropertyAltKey_fr1(){
runMyTest("testHiddenPropertyAltKey1_fr", "fr");
}
public void testHiddenPropertyAltKey_fr2(){
runMyTest("testHiddenPropertyAltKey2_fr", "fr");
}
public void testHiddenPropertyOnblur(){
runMyTest("testHiddenPropertyOnblur", "");
}
public void testHiddenPropertyOnchange(){
runMyTest("testHiddenPropertyOnchange", "");
}
public void testHiddenPropertyOnclick(){
runMyTest("testHiddenPropertyOnclick", "");
}
public void testHiddenPropertyOndblclick(){
runMyTest("testHiddenPropertyOndblclick", "");
}
public void testHiddenPropertyOnfocus(){
runMyTest("testHiddenPropertyOnfocus", "");
}
public void testHiddenPropertyOnkeydown(){
runMyTest("testHiddenPropertyOnkeydown", "");
}
public void testHiddenPropertyOnkeypress(){
runMyTest("testHiddenPropertyOnkeypress", "");
}
public void testHiddenPropertyOnkeyup(){
runMyTest("testHiddenPropertyOnkeyup", "");
}
public void testHiddenPropertyOnmousedown(){
runMyTest("testHiddenPropertyOnmousedown", "");
}
public void testHiddenPropertyOnmousemove(){
runMyTest("testHiddenPropertyOnmousemove", "");
}
public void testHiddenPropertyOnmouseout(){
runMyTest("testHiddenPropertyOnmouseout", "");
}
public void testHiddenPropertyOnmouseover(){
runMyTest("testHiddenPropertyOnmouseover", "");
}
public void testHiddenPropertyOnmouseup(){
runMyTest("testHiddenPropertyOnmouseup", "");
}
}
1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestHiddenTag2.java
Index: TestHiddenTag2.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Struts", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.struts.taglib.html;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.StringTokenizer;
import javax.servlet.jsp.PageContext;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.cactus.JspTestCase;
import org.apache.struts.Globals;
import org.apache.struts.taglib.SimpleBeanForTesting;
/**
* Suite of unit tests for the
* <code>org.apache.struts.taglib.bean.HiddenTag</code> class.
*
* @author James Mitchell
*/
public class TestHiddenTag2 extends JspTestCase {
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestHiddenTag2(String theName) {
super(theName);
}
/**
* Start the tests.
*
* @param theArgs the arguments. Not used
*/
public static void main(String[] theArgs) {
junit.awtui.TestRunner.main(new String[] {TestHiddenTag2.class.getName()});
}
/**
* @return a test suite (<code>TestSuite</code>) that includes all methods
* starting with "test"
*/
public static Test suite() {
// All methods starting with "test" will be executed in the test suite.
return new TestSuite(TestHiddenTag2.class);
}
private void runMyTest(String whichTest, String locale){
pageContext.setAttribute(Globals.LOCALE_KEY, new Locale(locale, locale), PageContext.SESSION_SCOPE);
pageContext.setAttribute(Constants.BEAN_KEY, new SimpleBeanForTesting("Test Value"), PageContext.REQUEST_SCOPE);
request.setAttribute("runTest", whichTest);
try {
pageContext.forward("/test/org/apache/struts/taglib/html/TestHiddenTag2.jsp");
}
catch (Exception e) {
e.printStackTrace();
fail("There is a problem that is preventing the tests to continue!");
}
}
/*
* Testing HiddenTag.
*/
public void testHiddenPropertyStyle(){
runMyTest("testHiddenPropertyStyle", "");
}
public void testHiddenPropertyStyleClass(){
runMyTest("testHiddenPropertyStyleClass", "");
}
public void testHiddenPropertyStyleId(){
runMyTest("testHiddenPropertyStyleId", "");
}
public void testHiddenPropertyTitle(){
runMyTest("testHiddenPropertyTitle", "");
}
public void testHiddenPropertyTitleKey(){
runMyTest("testHiddenPropertyTitleKey", "");
}
public void testHiddenPropertyTitleKey_fr(){
runMyTest("testHiddenPropertyTitleKey_fr", "fr");
}
public void testHiddenPropertyValue(){
runMyTest("testHiddenPropertyValue", "");
}
public void testHiddenPropertyIndexedArray(){
ArrayList lst = new ArrayList();
lst.add("Test Message");
pageContext.setAttribute("lst", lst, PageContext.REQUEST_SCOPE);
runMyTest("testHiddenPropertyIndexedArray", "");
}
public void testHiddenPropertyIndexedArrayProperty(){
SimpleBeanForTesting sbft = new SimpleBeanForTesting();
ArrayList lst = new ArrayList();
lst.add("Test Message");
sbft.setList(lst);
pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testHiddenPropertyIndexedArrayProperty", "");
}
public void testHiddenPropertyIndexedMap(){
HashMap map = new HashMap();
map.put("tst1", "Test Message");
pageContext.setAttribute("lst", map, PageContext.REQUEST_SCOPE);
runMyTest("testHiddenPropertyIndexedMap", "");
}
public void testHiddenPropertyIndexedMapProperty(){
SimpleBeanForTesting sbft = new SimpleBeanForTesting();
HashMap map = new HashMap();
map.put("tst1", "Test Message");
sbft.setMap(map);
pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testHiddenPropertyIndexedMapProperty", "");
}
public void testHiddenPropertyIndexedEnumeration(){
StringTokenizer st = new StringTokenizer("Test Message");
pageContext.setAttribute("lst", st, PageContext.REQUEST_SCOPE);
runMyTest("testHiddenPropertyIndexedEnumeration", "");
}
public void testHiddenPropertyIndexedEnumerationProperty(){
SimpleBeanForTesting sbft = new SimpleBeanForTesting();
StringTokenizer st = new StringTokenizer("Test Message");
sbft.setEnumeration(st);
pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testHiddenPropertyIndexedEnumerationProperty", "");
}
}
1.1 jakarta-struts/web/test/test/org/apache/struts/taglib/html/TestHiddenTag1.jsp
Index: TestHiddenTag1.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="junit.framework.Assert"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<logic:equal name="runTest" value="testHiddenProperty">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyAccesskey">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" accesskey="a"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" accesskey="a" value="Test Value">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyAlt">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" alt="Testing alt attribute"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" alt="Testing alt attribute">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyAltKey1">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" altKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" alt="Testing Message">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyAltKey2">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" altKey="no.such.key"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyAltKey1_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" altKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" alt="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyAltKey2_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" altKey="no.such.key"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOnblur">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" onblur="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" onblur="Put script here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOnchange">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" onchange="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" onchange="Put script here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOnclick">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" onclick="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" onclick="Put script here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOndblclick">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" ondblclick="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" ondblclick="Put script here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOnfocus">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" onfocus="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" onfocus="Put script here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOnkeydown">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" onkeydown="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" onkeydown="Put script here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOnkeypress">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" onkeypress="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" onkeypress="Put script here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOnkeyup">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" onkeyup="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" onkeyup="Put script here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOnmousedown">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" onmousedown="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" onmousedown="Put script here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOnmousemove">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" onmousemove="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" onmousemove="Put script here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOnmouseout">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" onmouseout="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" onmouseout="Put script here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOnmouseover">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" onmouseover="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" onmouseover="Put script here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyOnmouseup">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" onmouseup="Put script here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" onmouseup="Put script here">
</bean:define>
</logic:equal>
<%
String expected = "";
String compareTo = "";
if (pageContext.getAttribute("EXPECTED_RESULTS") == null){
throw new JspException("No tests on this page were called. Please verify that you've setup the tests correctly.");
}else{
expected=pageContext.getAttribute("TEST_RESULTS").toString();
}
if (pageContext.getAttribute("TEST_RESULTS") != null){
compareTo=pageContext.getAttribute("EXPECTED_RESULTS").toString();
}
Assert.assertEquals(compareTo, expected);
%>
1.1 jakarta-struts/web/test/test/org/apache/struts/taglib/html/TestHiddenTag2.jsp
Index: TestHiddenTag2.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="junit.framework.Assert"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<logic:equal name="runTest" value="testHiddenPropertyStyle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" style="Put something here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" style="Put something here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyStyleClass">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" styleClass="Put something here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" class="Put something here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyStyleId">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" styleId="Put something here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" id="Put something here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyTitle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" title="Put something here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" title="Put something here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyTitleKey">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" titleKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" title="Testing Message">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyTitleKey_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" titleKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Test Value" title="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyValue">
<bean:define id="TEST_RESULTS" toScope="page">
<html:hidden property="string" value ="Put something here"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="string" value="Put something here">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyIndexedArray">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst">
<html:hidden property="string" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="org.apache.struts.taglib.html.BEAN[0].string" value="Test Value">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyIndexedArrayProperty">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst" property="list">
<html:hidden property="string" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="org.apache.struts.taglib.html.BEAN[0].string" value="Test Value">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyIndexedMap">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst">
<html:hidden property="string" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="org.apache.struts.taglib.html.BEAN[0].string" value="Test Value">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyIndexedMapProperty">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst" property="map">
<html:hidden property="string" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="org.apache.struts.taglib.html.BEAN[0].string" value="Test Value">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyIndexedEnumeration">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst">
<html:hidden property="string" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="org.apache.struts.taglib.html.BEAN[0].string" value="Test Value">
<input type="hidden" name="org.apache.struts.taglib.html.BEAN[1].string" value="Test Value">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testHiddenPropertyIndexedEnumerationProperty">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst" property="enumeration">
<html:hidden property="string" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="hidden" name="org.apache.struts.taglib.html.BEAN[0].string" value="Test Value">
<input type="hidden" name="org.apache.struts.taglib.html.BEAN[1].string" value="Test Value">
</bean:define>
</logic:equal>
<%
String expected = "";
String compareTo = "";
if (pageContext.getAttribute("EXPECTED_RESULTS") == null){
throw new JspException("No tests on this page were called. Please verify that you've setup the tests correctly.");
}else{
expected=pageContext.getAttribute("TEST_RESULTS").toString();
}
if (pageContext.getAttribute("TEST_RESULTS") != null){
compareTo=pageContext.getAttribute("EXPECTED_RESULTS").toString();
}
Assert.assertEquals(compareTo, expected);
%>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org