status.setMethod(statusArray[0].toUpperCase());
@Test public void shouldReturnGetRequestParametersMapOnGetMethod() { requestStatus.setMethod(HttpServletRequest.METHOD_GET); assertThat(httpServletRequestImpl.getParameter("getKey"), is("getValue")); assertThat(((Map<String, String>) httpServletRequestImpl.getParameterMap()), hasKey("getKey")); assertThat(((Map<String, String>) httpServletRequestImpl.getParameterMap()), not(hasKey("postKey"))); assertThat((List<String>) (Collections.list(httpServletRequestImpl.getParameterNames())), hasSize(1)); assertThat((List<String>) (Collections.list(httpServletRequestImpl.getParameterNames())), hasItems("getKey")); assertThat((List<String>) (Collections.list(httpServletRequestImpl.getParameterNames())), not(hasItems("postKey"))); }
@Test public void shouldReturnPostRequestParametersMapOnPostMethod() { requestStatus.setMethod(HttpServletRequest.METHOD_POST); assertThat(httpServletRequestImpl.getPostParameter("postKey"), is("postValue")); assertThat(((Map<String, String>) httpServletRequestImpl.getParameterMap()), hasKey("postKey")); assertThat(((Map<String, String>) httpServletRequestImpl.getParameterMap()), not(hasKey("getKey"))); assertThat((List<String>) (Collections.list(httpServletRequestImpl.getParameterNames())), hasSize(1)); assertThat((List<String>) (Collections.list(httpServletRequestImpl.getParameterNames())), hasItems("postKey")); assertThat((List<String>) (Collections.list(httpServletRequestImpl.getParameterNames())), not(hasItems("getKey"))); }
@Test public void shouldReturnPostRequestParametersMapOnPutMethod() { requestStatus.setMethod(HttpServletRequest.METHOD_PUT); assertThat(httpServletRequestImpl.getPostParameter("postKey"), is("postValue")); assertThat(((Map<String, String>) httpServletRequestImpl.getParameterMap()), hasKey("postKey")); assertThat(((Map<String, String>) httpServletRequestImpl.getParameterMap()), not(hasKey("getKey"))); assertThat((List<String>) (Collections.list(httpServletRequestImpl.getParameterNames())), hasSize(1)); assertThat((List<String>) (Collections.list(httpServletRequestImpl.getParameterNames())), hasItems("postKey")); assertThat((List<String>) (Collections.list(httpServletRequestImpl.getParameterNames())), not(hasItems("getKey"))); }
@Test public void shouldReturnCorrectValuesGetters() { requestStatus.setMethod(HttpServletRequest.METHOD_GET); httpServletRequestImpl.setAttribute("name", "value"); assertThat((List<String>) (Collections.list(httpServletRequestImpl.getAttributeNames())), hasSize(1));
@Before public void setUp() { requestStatus = new RequestStatus(); requestStatus.setMethod(HttpServletRequest.METHOD_GET); requestStatus.setQueryString("a=1&b=2"); requestStatus.setUri("/someuri");