### Question:
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);  }### Answer:
@Test public void getPropertiesWhenNoConflict() { when(this.httpRequest.getParameterValues("key")).thenReturn(new String[]{ "value1", "value2" }); when(this.httpRequest.getAttribute("key")).thenReturn("value3"); ServletRequest request = new ServletRequest(this.httpRequest); List<Object> values = request.getProperties("key"); assertEquals(Arrays.asList("value1", "value2", "value3"), values); }
@Test public void getPropertiesWhenConflict() { when(this.httpRequest.getParameterValues("key")).thenReturn(new String[]{ "value" }); when(this.httpRequest.getAttribute("key")).thenReturn("value"); ServletRequest request = new ServletRequest(this.httpRequest); List<Object> values = request.getProperties("key"); assertEquals(Arrays.asList("value", "value"), values); }
@Test public void getPropertiesWhenNoExistAsRequestParam() { when(this.httpRequest.getParameterValues("key")).thenReturn(null); when(this.httpRequest.getAttribute("key")).thenReturn("value"); ServletRequest request = new ServletRequest(this.httpRequest); List<Object> result = request.getProperties("key"); assertEquals(1, result.size()); assertEquals("value", result.get(0)); }
@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)); }