@Test
public void testGetSessionAttributes() 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").
          createMock();
  expect(cluster.getSessionManager()).andReturn(sessionManager).anyTimes();
  expect(cluster.getClusterName()).andReturn("c1").anyTimes();
  expect(sessionManager.getAttribute("cluster_session_attributes:c1")).andReturn(attributes);
  expect(sessionManager.getAttribute("cluster_session_attributes:c1")).andReturn(null);
  replay(sessionManager, cluster);
  assertEquals(attributes, cluster.getSessionAttributes());
  assertEquals(Collections.<String, Object>emptyMap(), cluster.getSessionAttributes());
  verify(sessionManager, cluster);
}