struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject struts git commit: WW-4837 Adds a test to proof that Integers are treated as Integers
Date Fri, 04 Aug 2017 05:49:50 GMT
Repository: struts
Updated Branches:
  refs/heads/master c2aeaf2ea -> 3e53a58bb


WW-4837 Adds a test to proof that Integers are treated as Integers


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/3e53a58b
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/3e53a58b
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/3e53a58b

Branch: refs/heads/master
Commit: 3e53a58bb33c10fab04a4364a829ba03ac7fbc49
Parents: c2aeaf2
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Fri Aug 4 07:49:38 2017 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Fri Aug 4 07:49:38 2017 +0200

----------------------------------------------------------------------
 .../apache/struts2/views/jsp/ui/SelectTest.java | 57 ++++++++++++++++++++
 .../apache/struts2/views/jsp/ui/Select-14.txt   | 10 ++++
 2 files changed, 67 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/3e53a58b/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java
index 06b7e80..c6587df 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java
@@ -135,6 +135,45 @@ public class SelectTest extends AbstractUITagTest {
         verify(SelectTag.class.getResource("Select-3.txt"));
     }
 
+    public void testInteger() throws Exception {
+        IntegerObject hello = new IntegerObject("hello", 1);
+        IntegerObject foo = new IntegerObject("foo", 2);
+
+        TestAction testAction = (TestAction) action;
+
+        Collection collection = new ArrayList(2);
+        // expect strings to be returned, we're still dealing with HTTP here!
+        collection.add("hello");
+        collection.add("foo");
+        testAction.setCollection(collection);
+
+        List list2 = new ArrayList();
+        list2.add(hello);
+        list2.add(foo);
+        list2.add(new IntegerObject("<cat>", 3));
+        testAction.setList2(list2);
+
+        SelectTag tag = new SelectTag();
+        tag.setPageContext(pageContext);
+        tag.setLabel("mylabel");
+        tag.setName("collection");
+        tag.setList("list2");
+        tag.setListKey("name");
+        tag.setListValue("integer");
+        tag.setMultiple("true");
+        tag.setTitle("mytitle");
+        tag.setOnmousedown("alert('onmousedown');");
+        tag.setOnmousemove("alert('onmousemove');");
+        tag.setOnmouseout("alert('onmouseout');");
+        tag.setOnmouseover("alert('onmouseover');");
+        tag.setOnmouseup("alert('onmouseup');");
+
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(SelectTag.class.getResource("Select-14.txt"));
+    }
+
     public class BigDecimalObject {
         private String name;
         private BigDecimal bigDecimal;
@@ -153,6 +192,24 @@ public class SelectTest extends AbstractUITagTest {
         }
     }
 
+    public class IntegerObject {
+        private String name;
+        private Integer integer;
+
+        public IntegerObject(String name, Integer integer) {
+            this.name = name;
+            this.integer = integer;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public Integer getInteger() {
+            return integer;
+        }
+    }
+
     public class ByteObject {
         private String name;
         private Byte byteValue;

http://git-wip-us.apache.org/repos/asf/struts/blob/3e53a58b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-14.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-14.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-14.txt
new file mode 100644
index 0000000..2f0b05f
--- /dev/null
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-14.txt
@@ -0,0 +1,10 @@
+<tr>
+    <td class="tdLabel"><label for="collection" class="label">mylabel:</label></td>
+    <td class="tdInput"><select name="collection" id="collection" title="mytitle"
multiple="multiple" onmousedown="alert('onmousedown');" onmouseup="alert('onmouseup');" onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');" onmouseout="alert('onmouseout');">
+    <option value="hello" selected="selected">1</option>
+    <option value="foo" selected="selected">2</option>
+    <option value="&lt;cat&gt;">3</option>
+</select>
+<inputtype="hidden" id="__multiselect_collection" name="__multiselect_collection" value=""/>
+</td>
+</tr>


Mime
View raw message