You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2023/05/16 18:00:24 UTC
[struts] branch WW-5302-unevaluated-id updated: WW-5302 Adds additional test case to cover evaluating action & method attribute at the same time
This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch WW-5302-unevaluated-id
in repository https://gitbox.apache.org/repos/asf/struts.git
The following commit(s) were added to refs/heads/WW-5302-unevaluated-id by this push:
new f9f05dc97 WW-5302 Adds additional test case to cover evaluating action & method attribute at the same time
f9f05dc97 is described below
commit f9f05dc97984ab152a38f211f434b753ddb005f0
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Tue May 16 20:00:18 2023 +0200
WW-5302 Adds additional test case to cover evaluating action & method attribute at the same time
---
.../test/java/com/opensymphony/xwork2/TestBean.java | 21 ++++++++++-----------
.../apache/struts2/components/FormButtonTest.java | 18 ++++++++++++++++++
2 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/core/src/test/java/com/opensymphony/xwork2/TestBean.java b/core/src/test/java/com/opensymphony/xwork2/TestBean.java
index 8b1a8ff4c..fd5bc59d4 100644
--- a/core/src/test/java/com/opensymphony/xwork2/TestBean.java
+++ b/core/src/test/java/com/opensymphony/xwork2/TestBean.java
@@ -20,25 +20,18 @@ package com.opensymphony.xwork2;
import java.util.Date;
-
-/**
- * TestBean
- *
- * @author Jason Carreira
- * Created Aug 4, 2003 12:39:53 AM
- */
public class TestBean {
private Date birth;
private String name;
private int count;
-
+ private String subName;
+
private TestChildBean child = new TestChildBean();
public TestBean() {
}
-
public void setBirth(Date birth) {
this.birth = birth;
}
@@ -63,13 +56,19 @@ public class TestBean {
return name;
}
-
public TestChildBean getChild() {
return child;
}
-
public void setChild(TestChildBean child) {
this.child = child;
}
+
+ public String getSubName() {
+ return subName;
+ }
+
+ public void setSubName(String subName) {
+ this.subName = subName;
+ }
}
diff --git a/core/src/test/java/org/apache/struts2/components/FormButtonTest.java b/core/src/test/java/org/apache/struts2/components/FormButtonTest.java
index a390682d5..429ecfd6c 100644
--- a/core/src/test/java/org/apache/struts2/components/FormButtonTest.java
+++ b/core/src/test/java/org/apache/struts2/components/FormButtonTest.java
@@ -136,4 +136,22 @@ public class FormButtonTest extends StrutsInternalTestCase {
assertEquals("secondAction", submit.getParameters().get("id"));
}
+
+ public void testPopulateComponentHtmlId8() {
+ MockHttpServletRequest req = new MockHttpServletRequest();
+ MockHttpServletResponse res = new MockHttpServletResponse();
+ ValueStack stack = ActionContext.getContext().getValueStack();
+ TestBean bean = new TestBean();
+ bean.setName("boo");
+ bean.setSubName("foo");
+ stack.push(bean);
+
+ Submit submit = new Submit(stack, req, res);
+ submit.setAction("%{name}");
+ submit.setMethod("%{subName}");
+
+ submit.populateComponentHtmlId(null);
+
+ assertEquals("boo_foo", submit.getParameters().get("id"));
+ }
}