@Test public void shouldReturnRequestParametersWithParametersFromUnderlyingRequest() { String fooParamName = "fooKEY"; String barParamName = "barKEY"; when(mockHttpRequest.getParameterNames()).thenReturn(makeParameterNamesEnumeration(fooParamName, barParamName)); when(mockHttpRequest.getParameterValues(anyString())) .thenReturn(new String[] { "fooValue" }) .thenReturn(new String[] { "barValue" }); PippoWebContext context = makePippoWebContext(); Map<String, String[]> parameterMap = context.getRequestParameters(); assertThat(parameterMap.get(fooParamName), is(new String[] { "fooValue" })); assertThat(parameterMap.get(barParamName), is(new String[] { "barValue" })); verify(mockHttpRequest, times(1)).getParameterNames(); verify(mockHttpRequest, times(1)).getParameterValues(fooParamName); verify(mockHttpRequest, times(1)).getParameterValues(barParamName); }
@Override public Map<String, String[]> getRequestParameters() { Map<String, ParameterValue> parameters = getRequest().getParameters(); final Map<String, String[]> result = new HashMap<>(); parameters.forEach((s, parameterValue) -> result.put(s, parameterValue.getValues())); return result; }
PippoWebContext implements WebContext { @Override public Map<String, String[]> getRequestParameters() { Map<String, ParameterValue> parameters = getRequest().getParameters(); final Map<String, String[]> result = new HashMap<>(); parameters.forEach((s, parameterValue) -> result.put(s, parameterValue.getValues())); return result; } }
PippoWebContext implements WebContext { @Override public Map<String, String[]> getRequestParameters() { Map<String, ParameterValue> parameters = getRequest().getParameters(); final Map<String, String[]> result = new HashMap<>(); parameters.forEach((s, parameterValue) -> result.put(s, parameterValue.getValues())); return result; } PippoWebContext(RouteContext routeContext);  PippoWebContext(RouteContext routeContext, SessionStore<PippoWebContext> sessionStore); }
PippoWebContext implements WebContext { @Override public Map<String, String[]> getRequestParameters() { Map<String, ParameterValue> parameters = getRequest().getParameters(); final Map<String, String[]> result = new HashMap<>(); parameters.forEach((s, parameterValue) -> result.put(s, parameterValue.getValues())); return result; } PippoWebContext(RouteContext routeContext);  PippoWebContext(RouteContext routeContext, SessionStore<PippoWebContext> sessionStore); @Override SessionStore<PippoWebContext> getSessionStore(); @Override void setSessionStore(SessionStore sessionStore); @Override String getRequestParameter(String name); @Override Map<String, String[]> getRequestParameters(); @Override Object getRequestAttribute(String name); @Override void setRequestAttribute(String name, Object value); @Override String getRequestHeader(String name); @Override String getRequestMethod(); @Override String getRemoteAddr(); @Override void writeResponseContent(String contentToWrite); @Override void setResponseStatus(int statusCode); @Override void setResponseHeader(String name, String value); @Override void setResponseContentType(String contentType); @Override String getServerName(); @Override int getServerPort(); @Override String getScheme(); @Override boolean isSecure(); @Override String getFullRequestURL(); @Override Collection<Cookie> getRequestCookies(); @Override void addResponseCookie(Cookie cookie); @Override String getPath(); RouteContext getRouteContext(); Request getRequest(); Response getResponse(); }
PippoWebContext implements WebContext { @Override public Map<String, String[]> getRequestParameters() { Map<String, ParameterValue> parameters = getRequest().getParameters(); final Map<String, String[]> result = new HashMap<>(); parameters.forEach((s, parameterValue) -> result.put(s, parameterValue.getValues())); return result; } PippoWebContext(RouteContext routeContext);  PippoWebContext(RouteContext routeContext, SessionStore<PippoWebContext> sessionStore); @Override SessionStore<PippoWebContext> getSessionStore(); @Override void setSessionStore(SessionStore sessionStore); @Override String getRequestParameter(String name); @Override Map<String, String[]> getRequestParameters(); @Override Object getRequestAttribute(String name); @Override void setRequestAttribute(String name, Object value); @Override String getRequestHeader(String name); @Override String getRequestMethod(); @Override String getRemoteAddr(); @Override void writeResponseContent(String contentToWrite); @Override void setResponseStatus(int statusCode); @Override void setResponseHeader(String name, String value); @Override void setResponseContentType(String contentType); @Override String getServerName(); @Override int getServerPort(); @Override String getScheme(); @Override boolean isSecure(); @Override String getFullRequestURL(); @Override Collection<Cookie> getRequestCookies(); @Override void addResponseCookie(Cookie cookie); @Override String getPath(); RouteContext getRouteContext(); Request getRequest(); Response getResponse();  }