### Question:
PageContextHelper { public APISession getApiSession() { final HttpSession httpSession = request.getSession(); return (APISession) httpSession.getAttribute(ATTRIBUTE_API_SESSION); } PageContextHelper(HttpServletRequest request); String getCurrentProfile(); Locale getCurrentLocale(); APISession getApiSession(); static final String PROFILE_PARAM; static final String ATTRIBUTE_API_SESSION; }### Answer:
@Test public void should_return_ApiSession() throws Exception { doReturn(httpSession).when(request).getSession(); doReturn(apiSession).when(httpSession).getAttribute(pageContextHelper.ATTRIBUTE_API_SESSION); pageContextHelper = new PageContextHelper(request); final APISession returnedApiSession = pageContextHelper.getApiSession(); assertThat(returnedApiSession).isEqualTo(apiSession); }