@Test
public void testGetProjectedState() {

  String hostname = "host";
  String componentName = "component";
  Stage stage1 = createNiceMock(Stage.class);
  Stage stage2 = createNiceMock(Stage.class);
  Stage stage3 = createNiceMock(Stage.class);
  Stage stage4 = createNiceMock(Stage.class);
  HostRoleCommand command1 = createNiceMock(HostRoleCommand.class);
  HostRoleCommand command2 = createNiceMock(HostRoleCommand.class);
  HostRoleCommand command3 = createNiceMock(HostRoleCommand.class);
  List<Stage> stages = new ArrayList<Stage>();
  stages.add(stage1);
  stages.add(stage2);
  stages.add(stage3);
  stages.add(stage4);
  //expectations
  expect(stage1.getHostRoleCommands()).andReturn(Collections.singletonMap(hostname, Collections.singletonMap(componentName, command1))).anyTimes();
  expect(stage2.getHostRoleCommands()).andReturn(Collections.singletonMap(hostname, Collections.singletonMap(componentName, command2))).anyTimes();
  expect(stage3.getHostRoleCommands()).andReturn(Collections.singletonMap(hostname, Collections.singletonMap(componentName, command3))).anyTimes();
  expect(stage4.getHostRoleCommands()).andReturn(Collections.<String, Map<String, HostRoleCommand>>emptyMap()).anyTimes();
  expect(command3.getRoleCommand()).andReturn(RoleCommand.SERVICE_CHECK).anyTimes();
  expect(command2.getRoleCommand()).andReturn(RoleCommand.INSTALL).anyTimes();
  replay(stage1, stage2, stage3, stage4, command1, command2, command3);
  RequestStageContainer requestStages = new RequestStageContainer(1L, stages, null, null);
  assertEquals(State.INSTALLED, requestStages.getProjectedState(hostname, componentName));
  verify(stage1, stage2, stage3, stage4, command1, command2, command3);
}