Skip to content

Commit

Permalink
WW-5379 Fix not looking in chained contexts' chained contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
kusalk committed Dec 27, 2023
1 parent 3eddd56 commit 450ee91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ public Object internalGet(String key) {
}

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);
}

Expand All @@ -96,7 +96,7 @@ protected Object chainedContextGet(String key) {
return null;
}
for (VelocityContext chainedContext : chainedContexts) {
Object val = chainedContext.internalGet(key);
Object val = chainedContext.get(key);
if (val != null) {
return val;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void setUp() throws Exception {

@Test
public void getChainedValue() {
when(chainedContext.internalGet("foo")).thenReturn("bar");
when(chainedContext.get("foo")).thenReturn("bar");
assertEquals("bar", strutsVelocityContext.internalGet("foo"));
}

Expand All @@ -75,7 +75,7 @@ public void getValuePrecedence() {
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");
Expand Down

0 comments on commit 450ee91

Please sign in to comment.