@Test
public void testWorkflowDispatcherRetry() throws Exception {

  props.put(IBMWatsonTranscriptionService.MAX_ATTEMPTS_CONFIG, 2);
  props.put(IBMWatsonTranscriptionService.RETRY_WORKLFOW_CONFIG, RETRY_WORKFLOW);
  service.activate(cc);
  database.storeJobControl(MP_ID, TRACK_ID, JOB_ID, TranscriptionJobControl.Status.Retry.name(), TRACK_DURATION, DATE_EXPECTED, PROVIDER);
  Capture<Set<String>> capturedMpIds = mockAssetManagerAndWorkflow(RETRY_WORKFLOW, true);
  WorkflowDispatcher dispatcher = service.new WorkflowDispatcher();
  dispatcher.run();
  // Check if mp has a workflow created for it
  Assert.assertEquals(1, capturedMpIds.getValue().size());
  Assert.assertEquals(MP_ID, capturedMpIds.getValue().iterator().next());
  // Check if status of retry job in db was updated to error
  TranscriptionJobControl job = database.findByJob(JOB_ID);
  Assert.assertNotNull(job);
  Assert.assertEquals(TranscriptionJobControl.Status.Error.name(), job.getStatus());
}