@Test
public void testDispatch_EnqueueFail() throws Exception {

  DyneinJobSpec jobSpec = getTestJobSpec(validToken, "test4");
  Schedule schedule = getSchedule(jobSpec, false);
  Exception addException = new Exception();
  CompletableFuture<Void> error = new CompletableFuture<>();
  error.completeExceptionally(addException);
  when(asyncClient.add(schedule.getJobSpec(), "test4")).thenReturn(error);
  CompletableFuture<Void> ret = worker.dispatchToDestination(schedule);
  try {
    ret.get(1000, TimeUnit.MILLISECONDS);
  } catch (ExecutionException e) {
    assertSame(e.getCause(), addException);
  }
  verify(asyncClient, times(1)).add(schedule.getJobSpec(), "test4");
  verify(scheduleManager, times(1))
      .updateStatus(schedule, Schedule.JobStatus.ACQUIRED, Schedule.JobStatus.SCHEDULED);
  verifyNoMoreInteractions(scheduleManager, asyncClient);
}