RequestWithHeadersServletAdapter implements RequestWithHeaders { @Override public Object getAttribute(String name) { return httpServletRequest.getAttribute(name); } RequestWithHeadersServletAdapter(HttpServletRequest httpServletRequest); @Override String getHeader(String headerName); @Override Object getAttribute(String name);  }
@Test public void getAttribute_delegates_to_servlet_request() { String attributeKey = "someAttr"; Object attributeValue = UUID.randomUUID(); doReturn(attributeValue).when(requestMock).getAttribute(attributeKey); Object actual = adapter.getAttribute(attributeKey); assertThat(actual).isEqualTo(attributeValue); verify(requestMock).getAttribute(attributeKey); }