@Test
public void testAddSessionAttributes() throws Exception {

  Map<String, Object> attributes = new HashMap<String, Object>();
  attributes.put("foo", "bar");
  AmbariSessionManager sessionManager = createMock(AmbariSessionManager.class);
  ClusterImpl cluster =
      createMockBuilder(ClusterImpl.class).
          addMockedMethod("getSessionManager").
          addMockedMethod("getClusterName").
          addMockedMethod("getSessionAttributes").
          createMock();
  expect(cluster.getSessionManager()).andReturn(sessionManager);
  expect(cluster.getClusterName()).andReturn("c1");
  expect(cluster.getSessionAttributes()).andReturn(attributes);
  sessionManager.setAttribute("cluster_session_attributes:c1", attributes);
  replay(sessionManager, cluster);
  cluster.addSessionAttributes(attributes);
  verify(sessionManager, cluster);
}