mirror of
https://github.com/apache/struts.git
synced 2026-08-07 15:46:57 +00:00
WW-5363 Remove redundant method from VelocityManager
This commit is contained in:
+1
-8
@@ -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;
|
||||
|
||||
-15
@@ -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"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user