AmbariSessionManager { public void removeAttribute(String name) { HttpSession session = getHttpSession(); if (session != null) { session.removeAttribute(name); } }  String getCurrentSessionId(); String getSessionCookie(); void setAttribute(String name, Object value); Object getAttribute(String name); void removeAttribute(String name);  }
@Test public void testRemoveAttribute() throws Exception { HttpSession session = createNiceMock(HttpSession.class); AmbariSessionManager sessionManager = createMockBuilder(AmbariSessionManager.class).addMockedMethod("getHttpSession").createMock(); expect(sessionManager.getHttpSession()).andReturn(session); session.removeAttribute("foo"); replay(session, sessionManager); sessionManager.removeAttribute("foo"); verify(session, sessionManager); }