@Test public void testGetCurrentSessionId() throws Exception { HttpSession session = createNiceMock(HttpSession.class); AmbariSessionManager sessionManager = createMockBuilder(AmbariSessionManager.class).addMockedMethod("getHttpSession").createMock(); expect(sessionManager.getHttpSession()).andReturn(session); expect(sessionManager.getHttpSession()).andReturn(null); expect(session.getId()).andReturn("SESSION_ID").anyTimes(); replay(session, sessionManager); assertEquals("SESSION_ID", sessionManager.getCurrentSessionId()); assertNull(sessionManager.getCurrentSessionId()); verify(session, sessionManager); }
public String getCurrentSessionId() { HttpSession session = getHttpSession(); return session == null ? null : session.getId(); }
AmbariSessionManager { public String getCurrentSessionId() { HttpSession session = getHttpSession(); return session == null ? null : session.getId(); } }
AmbariSessionManager { public String getCurrentSessionId() { HttpSession session = getHttpSession(); return session == null ? null : session.getId(); }  }
AmbariSessionManager { public String getCurrentSessionId() { HttpSession session = getHttpSession(); return session == null ? null : session.getId(); }  String getCurrentSessionId(); String getSessionCookie(); void setAttribute(String name, Object value); Object getAttribute(String name); void removeAttribute(String name); }
AmbariSessionManager { public String getCurrentSessionId() { HttpSession session = getHttpSession(); return session == null ? null : session.getId(); }  String getCurrentSessionId(); String getSessionCookie(); void setAttribute(String name, Object value); Object getAttribute(String name); void removeAttribute(String name);  }