### Question:
PortletRequest implements Request { @Override public Object getProperty(String key) { Object result; result = this.portletRequest.getParameter(key); if (result == null) { result = this.portletRequest.getAttribute(key); } return result; } PortletRequest(javax.portlet.PortletRequest portletRequest); javax.portlet.PortletRequest getPortletRequest(); @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 getPropertyWhenNoExistAsRequestParam() { final javax.portlet.PortletRequest portletRequest = mockery.mock(javax.portlet.PortletRequest.class); this.mockery.checking(new Expectations() {{ oneOf(portletRequest).getParameter("key"); will(returnValue("value")); }}); PortletRequest request = new PortletRequest(portletRequest); Assert.assertEquals("value", request.getProperty("key")); }
@Test public void getPropertyWhenNoExistAsAttributeParam() { final javax.portlet.PortletRequest portletRequest = mockery.mock(javax.portlet.PortletRequest.class); this.mockery.checking(new Expectations() {{ oneOf(portletRequest).getParameter("key"); will(returnValue(null)); oneOf(portletRequest).getAttribute("key"); will(returnValue("value")); }}); PortletRequest request = new PortletRequest(portletRequest); Assert.assertEquals("value", request.getProperty("key")); }