@Test
public void testCreateAmbariHostResources() throws Exception {

  // expectations
  expect(cluster.getServices()).andReturn(clusterServices).anyTimes();
  hostResourceProvider.createHosts(anyObject(Request.class));
  expectLastCall().once();
  expect(cluster.getService("service1")).andReturn(mockService1).times(2);
  expect(cluster.getService("service2")).andReturn(mockService1).once();
  Capture<Set<ServiceComponentHostRequest>> requestsCapture = EasyMock.newCapture();
  controller.createHostComponents(capture(requestsCapture));
  expectLastCall().once();
  replayAll();
  // test
  Map<String, Collection<String>> componentsMap = new HashMap<>();
  Collection<String> components = new ArrayList<>();
  components.add("component1");
  components.add("component2");
  componentsMap.put("service1", components);
  components = new ArrayList<>();
  components.add("component3");
  componentsMap.put("service2", components);
  context.createAmbariHostResources(CLUSTER_ID, "host1", componentsMap);
  assertEquals(requestsCapture.getValue().size(), 3);
}