@Test
public void testRemoveSessionAttribute() throws Exception {

  Map<String, Object> attributes = new HashMap<String, Object>();
  attributes.put("foo", "bar");
  attributes.put("foo2", "bar2");
  Map<String, Object> trimmedAttributes = new HashMap<String, Object>(attributes);
  trimmedAttributes.remove("foo2");
  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", trimmedAttributes);
  expectLastCall().once();
  replay(sessionManager, cluster);
  cluster.removeSessionAttribute("foo2");
  verify(sessionManager, cluster);
}