WW-3144 Adds additional test case to prove that there no problem

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1384088 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Lukasz Lenart
2012-09-12 19:11:29 +00:00
parent 075f5bdae4
commit 95f94ccb64
3 changed files with 23 additions and 15 deletions
@@ -244,18 +244,6 @@ public abstract class AbstractUITagTest extends AbstractTagTest {
* @throws Exception if the validation failed
*/
public void verify(URL url) throws Exception {
verify(url, null);
}
/**
* Attempt to verify the contents of this.writer against the contents of the URL specified. verify() performs a
* trim on both ends
*
* @param url the HTML snippet that we want to validate against
* @param excluded
* @throws Exception if the validation failed
*/
public void verify(URL url, String[] excluded) throws Exception {
if (url == null) {
fail("unable to verify a null URL");
} else if (this.writer == null) {
@@ -21,12 +21,12 @@
package org.apache.struts2.views.jsp.ui;
import java.util.HashMap;
import java.util.Map;
import org.apache.struts2.TestAction;
import org.apache.struts2.views.jsp.AbstractUITagTest;
import java.util.HashMap;
import java.util.Map;
/**
*/
@@ -152,4 +152,23 @@ public class LabelTest extends AbstractUITagTest {
verify(LabelTest.class.getResource("Label-4.txt"));
}
public void testWithJustKeyValueFromStack() throws Exception {
TestAction testAction = (TestAction) action;
final String key = "labelKey";
final String value = "baz";
// put key with message in a "resource"
testAction.setText(key, value);
LabelTag tag = new LabelTag();
tag.setPageContext(pageContext);
tag.setKey(key);
tag.setTheme("simple");
tag.doStartTag();
tag.doEndTag();
verify(LabelTest.class.getResource("Label-6.txt"));
}
}
@@ -0,0 +1 @@
<label id="labelKey">baz</label>