@Test
  public void testMultipleManualInstances() throws Exception {
    TaskScheduleUtil.waitForAllTasksToStop();
    getEventInspectorsUtil().waitForCalmPeriod();

    createSnapshotTask("Nexus1650Task1");
    createSnapshotTask("Nexus1650Task2");
    createSnapshotTask("Nexus1650Task3");

    List<ScheduledServiceListResource> tasks = TaskScheduleUtil.getTasks();

    assertThat(tasks, hasSize(3));

    long startTimestamp = System.currentTimeMillis();

    for (ScheduledServiceListResource resource : tasks) {
      TaskScheduleUtil.run(resource.getId());
    }

    waitForOneTaskSleeping();

    TaskScheduleUtil.waitForAllTasksToStop();

    assertAllTasksWereRunning(startTimestamp);
  }
  private void assertAllTasksWereRunning(long startTimestamp) throws IOException {
    final List<ScheduledServiceListResource> tasks = TaskScheduleUtil.getTasks();

    for (ScheduledServiceListResource task : tasks) {
      assertThat(
          "task did not run properly!", task.getLastRunTimeInMillis(), greaterThan(startTimestamp));
    }
  }
  private boolean isAtLeastOneSleeping() throws Exception {
    List<ScheduledServiceListResource> tasks = TaskScheduleUtil.getTasks();

    for (ScheduledServiceListResource resource : tasks) {
      if (resource.getStatus().equals("SLEEPING")) {
        return true;
      }
    }

    return false;
  }