mirror of
https://github.com/apache/struts.git
synced 2026-08-18 04:56:58 +00:00
test not throw exception on top missing property (WW-4999)
instead continue to next objects in stack Also tests not skip returned null values by user method
This commit is contained in:
@@ -954,6 +954,33 @@ public class OgnlValueStackTest extends XWorkTestCase {
|
|||||||
assertNull(vs.findValue("@com.nothing.here.Nothing@BLAH"));
|
assertNull(vs.findValue("@com.nothing.here.Nothing@BLAH"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fails on 2.5.20 and earlier - tested on 2.5 (5/5/2016) and failed
|
||||||
|
* @since 2.5.21
|
||||||
|
*/
|
||||||
|
public void testNotThrowExceptionOnTopMissingProperty() {
|
||||||
|
OgnlValueStack vs = createValueStack();
|
||||||
|
|
||||||
|
Dog dog = new Dog();
|
||||||
|
dog.setName("Rover");
|
||||||
|
vs.push(dog);
|
||||||
|
|
||||||
|
Cat cat = new Cat();
|
||||||
|
vs.push(cat);
|
||||||
|
|
||||||
|
vs.setValue("age", 12, true);
|
||||||
|
|
||||||
|
assertEquals(12, vs.findValue("age", true));
|
||||||
|
assertEquals(12, vs.findValue("age", Integer.class, true));
|
||||||
|
assertEquals(12, vs.findValue("getAge()", true));
|
||||||
|
assertEquals(12, vs.findValue("getAge()", Integer.class, true));
|
||||||
|
|
||||||
|
assertNull(vs.findValue("name", true));
|
||||||
|
assertNull(vs.findValue("name", String.class, true));
|
||||||
|
assertNull(vs.findValue("getName()", true));
|
||||||
|
assertNull(vs.findValue("getName()", String.class, true));
|
||||||
|
}
|
||||||
|
|
||||||
public void testTop() {
|
public void testTop() {
|
||||||
OgnlValueStack vs = createValueStack();
|
OgnlValueStack vs = createValueStack();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user