@Test public void getPropertiesWhenNoValueSetAsRequestAttribute() { when(this.httpRequest.getParameterValues("key")).thenReturn(new String[]{ "value" }); when(this.httpRequest.getAttribute("key")).thenReturn(null); ServletRequest request = new ServletRequest(this.httpRequest); List<Object> result = request.getProperties("key"); assertEquals(1, result.size()); assertEquals("value", result.get(0)); }
@Override public List<Object> getProperties(String key) { List<Object> result = new ArrayList<Object>(); Object[] requestParameters = this.httpServletRequest.getParameterValues(key); if (requestParameters != null) { result.addAll(Arrays.asList(requestParameters)); } Object attributeValue = this.httpServletRequest.getAttribute(key); if (attributeValue != null) { result.add(attributeValue); } return result; }
ServletRequest implements Request { @Override public List<Object> getProperties(String key) { List<Object> result = new ArrayList<Object>(); Object[] requestParameters = this.httpServletRequest.getParameterValues(key); if (requestParameters != null) { result.addAll(Arrays.asList(requestParameters)); } Object attributeValue = this.httpServletRequest.getAttribute(key); if (attributeValue != null) { result.add(attributeValue); } return result; } }
ServletRequest implements Request { @Override public List<Object> getProperties(String key) { List<Object> result = new ArrayList<Object>(); Object[] requestParameters = this.httpServletRequest.getParameterValues(key); if (requestParameters != null) { result.addAll(Arrays.asList(requestParameters)); } Object attributeValue = this.httpServletRequest.getAttribute(key); if (attributeValue != null) { result.add(attributeValue); } return result; } ServletRequest(HttpServletRequest httpServletRequest); }
ServletRequest implements Request { @Override public List<Object> getProperties(String key) { List<Object> result = new ArrayList<Object>(); Object[] requestParameters = this.httpServletRequest.getParameterValues(key); if (requestParameters != null) { result.addAll(Arrays.asList(requestParameters)); } Object attributeValue = this.httpServletRequest.getAttribute(key); if (attributeValue != null) { result.add(attributeValue); } return result; } ServletRequest(HttpServletRequest httpServletRequest); HttpServletRequest getHttpServletRequest(); @Override Object getProperty(String key); @Override List<Object> getProperties(String key); @Override void setProperty(String key, Object value); @Override void removeProperty(String key); }
ServletRequest implements Request { @Override public List<Object> getProperties(String key) { List<Object> result = new ArrayList<Object>(); Object[] requestParameters = this.httpServletRequest.getParameterValues(key); if (requestParameters != null) { result.addAll(Arrays.asList(requestParameters)); } Object attributeValue = this.httpServletRequest.getAttribute(key); if (attributeValue != null) { result.add(attributeValue); } return result; } ServletRequest(HttpServletRequest httpServletRequest); HttpServletRequest getHttpServletRequest(); @Override Object getProperty(String key); @Override List<Object> getProperties(String key); @Override void setProperty(String key, Object value); @Override void removeProperty(String key);  }