@Test(expected = HostNotFoundException.class)
public void testGetHosts___HostNotFoundException_HostNotAssociatedWithCluster() throws Exception {

  // member state mocks
  Injector injector = createInjector();
  AmbariManagementController managementController = injector.getInstance(AmbariManagementController.class);
  Clusters clusters = injector.getInstance(Clusters.class);
  Cluster cluster = createMock(Cluster.class);
  Host host = createNiceMock(Host.class);
  // requests
  HostRequest request1 = new HostRequest("host1", "cluster1", Collections.<String, String>emptyMap());
  Set<HostRequest> setRequests = Collections.singleton(request1);
  // expectations
  expect(managementController.getClusters()).andReturn(clusters).anyTimes();
  expect(clusters.getCluster("cluster1")).andReturn(cluster);
  expect(clusters.getHost("host1")).andReturn(host);
  expect(cluster.getDesiredConfigs()).andReturn(new HashMap<String, DesiredConfig>()).anyTimes();
  expect(host.getHostName()).andReturn("host1").anyTimes();
  // because cluster is not in set will result in HostNotFoundException
  expect(clusters.getClustersForHost("host1")).andReturn(Collections.<Cluster>emptySet());
  // replay mocks
  replayAll();
  SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator());
  getHosts(managementController, setRequests);
  verifyAll();
}