@Override
      public List<HostRoleCommand> answer(InvocationOnMock invocation) throws Throwable {
        String role = (String) invocation.getArguments()[0];
        HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[1];

        HostRoleCommand task = s.getHostRoleCommand(null, role);

        if (task.getStatus() == status) {
          return Arrays.asList(task);
        } else {
          return Collections.emptyList();
        }
      }
Ensures that the task is timed out and that it will be skipped.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java