@Test
public void testConfigureSessionManager() throws Exception {

  AmbariServer ambariServer = new AmbariServer();
  Configuration configuration = createNiceMock(Configuration.class);
  SessionManager sessionManager = createNiceMock(SessionManager.class);
  SessionCookieConfig sessionCookieConfig = createNiceMock(SessionCookieConfig.class);
  ambariServer.configs = configuration;
  expect(sessionManager.getSessionCookieConfig()).andReturn(sessionCookieConfig).anyTimes();
  expect(configuration.getApiSSLAuthentication()).andReturn(false);
  sessionCookieConfig.setHttpOnly(true);
  expect(configuration.getApiSSLAuthentication()).andReturn(true);
  sessionCookieConfig.setHttpOnly(true);
  sessionCookieConfig.setSecure(true);
  replay(configuration, sessionManager, sessionCookieConfig);
  // getApiSSLAuthentication == false
  ambariServer.configureSessionManager(sessionManager);
  // getApiSSLAuthentication == true
  ambariServer.configureSessionManager(sessionManager);
  verify(configuration, sessionManager, sessionCookieConfig);
}