AmbariSessionManager { public String getSessionCookie() { return sessionManager.getSessionCookieConfig().getName(); }  String getCurrentSessionId(); String getSessionCookie(); void setAttribute(String name, Object value); Object getAttribute(String name); void removeAttribute(String name);  }
@Test public void testGetSessionCookie() throws Exception { SessionManager sessionManager = createNiceMock(SessionManager.class); SessionCookieConfig sessionCookieConfig = createNiceMock(SessionCookieConfig.class); AmbariSessionManager ambariSessionManager = new AmbariSessionManager(); ambariSessionManager.sessionManager = sessionManager; expect(sessionCookieConfig.getName()).andReturn("SESSION_COOKIE").anyTimes(); expect(sessionManager.getSessionCookieConfig()).andReturn(sessionCookieConfig).anyTimes(); replay(sessionManager, sessionCookieConfig); assertEquals("SESSION_COOKIE", ambariSessionManager.getSessionCookie()); verify(sessionManager, sessionCookieConfig); }