@Test
public void testValidateTopology_autoDeploy() throws Exception {

  group1Components.add("component2");
  services.addAll(Collections.singleton("service1"));
  expect(blueprint.getHostGroupsForComponent("component1")).andReturn(Collections.<HostGroup>emptyList()).anyTimes();
  expect(blueprint.getHostGroupsForComponent("component2")).andReturn(Arrays.asList(group1, group2)).anyTimes();
  expect(stack.getComponents("service1")).andReturn(Arrays.asList("component1", "component2")).anyTimes();
  expect(stack.getAutoDeployInfo("component1")).andReturn(autoDeploy).anyTimes();
  expect(group1.addComponent("component1")).andReturn(true).once();
  replay(blueprint, stack, group1, group2, dependency1);
  BlueprintValidator validator = new BlueprintValidatorImpl(blueprint);
  validator.validateTopology();
  verify(group1);
}