WW-5379 Fix not looking in chained contexts' chained contexts

This commit is contained in:
Kusal Kithul-Godage
2023-12-28 08:07:33 +11:00
parent 3eddd56d2d
commit 450ee91b03
2 changed files with 5 additions and 5 deletions
@@ -77,10 +77,10 @@ public class StrutsVelocityContext extends VelocityContext {
}
protected List<Function<String, Object>> contextGetterList() {
return Arrays.asList(this::superGet, this::chainedContextGet, this::stackGet);
return Arrays.asList(this::superInternalGet, this::chainedContextGet, this::stackGet);
}
protected Object superGet(String key) {
protected Object superInternalGet(String key) {
return super.internalGet(key);
}
@@ -96,7 +96,7 @@ public class StrutsVelocityContext extends VelocityContext {
return null;
}
for (VelocityContext chainedContext : chainedContexts) {
Object val = chainedContext.internalGet(key);
Object val = chainedContext.get(key);
if (val != null) {
return val;
}
@@ -54,7 +54,7 @@ public class StrutsVelocityContextTest {
@Test
public void getChainedValue() {
when(chainedContext.internalGet("foo")).thenReturn("bar");
when(chainedContext.get("foo")).thenReturn("bar");
assertEquals("bar", strutsVelocityContext.internalGet("foo"));
}
@@ -75,7 +75,7 @@ public class StrutsVelocityContextTest {
when(stack.findValue("foo")).thenReturn("qux");
assertEquals("qux", strutsVelocityContext.internalGet("foo"));
when(chainedContext.internalGet("foo")).thenReturn("baz");
when(chainedContext.get("foo")).thenReturn("baz");
assertEquals("baz", strutsVelocityContext.internalGet("foo"));
strutsVelocityContext.put("foo", "bar");