@Test public void readHttpResponseStatus() { when(httpServletResponse.getStatus()).thenReturn(200); int responseCode = extractor.getResponseStatus(httpServletResponse.getClass(), httpServletResponse); assertThat(responseCode, is(200)); }
public int getResponseStatus(Class<?> httpServletResponseClass, Object httpServletResponse) { Method getStatusMethod = retrieveMethod(HttpMethods.RESPONSE_GET_STATUS, httpServletResponseClass); if (null == getStatusMethod) { return 0; } try { return (Integer) getStatusMethod.invoke(httpServletResponse); } catch (Exception e) { LOG.error("Invocation of to get response status on given object failed.", e); } return 0; }
HttpInformationExtractor { public int getResponseStatus(Class<?> httpServletResponseClass, Object httpServletResponse) { Method getStatusMethod = retrieveMethod(HttpMethods.RESPONSE_GET_STATUS, httpServletResponseClass); if (null == getStatusMethod) { return 0; } try { return (Integer) getStatusMethod.invoke(httpServletResponse); } catch (Exception e) { LOG.error("Invocation of to get response status on given object failed.", e); } return 0; } }
HttpInformationExtractor { public int getResponseStatus(Class<?> httpServletResponseClass, Object httpServletResponse) { Method getStatusMethod = retrieveMethod(HttpMethods.RESPONSE_GET_STATUS, httpServletResponseClass); if (null == getStatusMethod) { return 0; } try { return (Integer) getStatusMethod.invoke(httpServletResponse); } catch (Exception e) { LOG.error("Invocation of to get response status on given object failed.", e); } return 0; } HttpInformationExtractor(StringConstraint strConstraint); }
HttpInformationExtractor { public int getResponseStatus(Class<?> httpServletResponseClass, Object httpServletResponse) { Method getStatusMethod = retrieveMethod(HttpMethods.RESPONSE_GET_STATUS, httpServletResponseClass); if (null == getStatusMethod) { return 0; } try { return (Integer) getStatusMethod.invoke(httpServletResponse); } catch (Exception e) { LOG.error("Invocation of to get response status on given object failed.", e); } return 0; } HttpInformationExtractor(StringConstraint strConstraint); String getRequestUri(Class<?> httpServletRequestClass, Object httpServletRequest); String getRequestMethod(Class<?> httpServletRequestClass, Object httpServletRequest); Map<String, String[]> getParameterMap(Class<?> httpServletRequestClass, Object httpServletRequest); Map<String, String> getAttributes(Class<?> httpServletRequestClass, Object httpServletRequest); Map<String, String> getHeaders(Class<?> httpServletRequestClass, Object httpServletRequest); Map<String, String> getSessionAttributes(Class<?> httpServletRequestClass, Object httpServletRequest); int getResponseStatus(Class<?> httpServletResponseClass, Object httpServletResponse); String getScheme(Class<?> httpServletRequestClass, Object httpServletRequest); String getServerName(Class<?> httpServletRequestClass, Object httpServletRequest); int getServerPort(Class<?> httpServletRequestClass, Object httpServletRequest); String getQueryString(Class<?> httpServletRequestClass, Object httpServletRequest); }
HttpInformationExtractor { public int getResponseStatus(Class<?> httpServletResponseClass, Object httpServletResponse) { Method getStatusMethod = retrieveMethod(HttpMethods.RESPONSE_GET_STATUS, httpServletResponseClass); if (null == getStatusMethod) { return 0; } try { return (Integer) getStatusMethod.invoke(httpServletResponse); } catch (Exception e) { LOG.error("Invocation of to get response status on given object failed.", e); } return 0; } HttpInformationExtractor(StringConstraint strConstraint); String getRequestUri(Class<?> httpServletRequestClass, Object httpServletRequest); String getRequestMethod(Class<?> httpServletRequestClass, Object httpServletRequest); Map<String, String[]> getParameterMap(Class<?> httpServletRequestClass, Object httpServletRequest); Map<String, String> getAttributes(Class<?> httpServletRequestClass, Object httpServletRequest); Map<String, String> getHeaders(Class<?> httpServletRequestClass, Object httpServletRequest); Map<String, String> getSessionAttributes(Class<?> httpServletRequestClass, Object httpServletRequest); int getResponseStatus(Class<?> httpServletResponseClass, Object httpServletResponse); String getScheme(Class<?> httpServletRequestClass, Object httpServletRequest); String getServerName(Class<?> httpServletRequestClass, Object httpServletRequest); int getServerPort(Class<?> httpServletRequestClass, Object httpServletRequest); String getQueryString(Class<?> httpServletRequestClass, Object httpServletRequest);  }