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

This commit is contained in:
Lukasz Lenart
2017-08-04 07:49:38 +02:00
parent c2aeaf2ead
commit 3e53a58bb3
2 changed files with 67 additions and 0 deletions
@@ -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;
@@ -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>