WW-5363 Remove redundant method from VelocityManager

This commit is contained in:
Kusal Kithul-Godage
2023-11-15 16:06:24 +11:00
parent 9f45983dac
commit 0504e7076c
2 changed files with 1 additions and 23 deletions
@@ -77,7 +77,7 @@ public class StrutsVelocityContext extends VelocityContext {
}
protected List<Function<String, Object>> contextGetterList() {
return Arrays.asList(this::superGet, this::chainedContextGet, this::stackGet, this::stackContextGet);
return Arrays.asList(this::superGet, this::chainedContextGet, this::stackGet);
}
protected Object superGet(String key) {
@@ -91,13 +91,6 @@ public class StrutsVelocityContext extends VelocityContext {
return stack.findValue(key);
}
protected Object stackContextGet(String key) {
if (stack == null) {
return null;
}
return stack.getContext().get(key);
}
protected Object chainedContextGet(String key) {
if (chainedContexts == null) {
return null;
@@ -27,9 +27,7 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static java.util.Collections.singletonList;
import static org.junit.Assert.assertEquals;
@@ -49,12 +47,8 @@ public class StrutsVelocityContextTest {
@Mock
private ValueStack stack;
private Map<String, Object> stackContext;
@Before
public void setUp() throws Exception {
stackContext = new HashMap<>();
when(stack.getContext()).thenReturn(stackContext);
strutsVelocityContext = new StrutsVelocityContext(singletonList(chainedContext), stack);
}
@@ -70,12 +64,6 @@ public class StrutsVelocityContextTest {
assertEquals("bar", strutsVelocityContext.internalGet("foo"));
}
@Test
public void getStackContextValue() {
stackContext.put("foo", "bar");
assertEquals("bar", strutsVelocityContext.internalGet("foo"));
}
@Test
public void getSuperValue() {
strutsVelocityContext.put("foo", "bar");
@@ -84,9 +72,6 @@ public class StrutsVelocityContextTest {
@Test
public void getValuePrecedence() {
stackContext.put("foo", "quux");
assertEquals("quux", strutsVelocityContext.internalGet("foo"));
when(stack.findValue("foo")).thenReturn("qux");
assertEquals("qux", strutsVelocityContext.internalGet("foo"));