@Test
public void testWorkflowDispatcherRunTranscriptionCompletedState() throws Exception {

  service.activate(cc);
  database.storeJobControl(MP_ID, TRACK_ID, JOB_ID, TranscriptionJobControl.Status.InProgress.name(), TRACK_DURATION, DATE_EXPECTED, PROVIDER);
  database.storeJobControl("mpId2", "audioTrack2", "jobId2", TranscriptionJobControl.Status.InProgress.name(),
          TRACK_DURATION, DATE_EXPECTED, PROVIDER);
  database.updateJobControl(JOB_ID, TranscriptionJobControl.Status.TranscriptionComplete.name());
  Capture<Set<String>> capturedMpIds = mockAssetManagerAndWorkflow(IBMWatsonTranscriptionService.DEFAULT_WF_DEF,
          true);
  WorkflowDispatcher dispatcher = service.new WorkflowDispatcher();
  dispatcher.run();
  // Check if only one mp has a workflow created for it
  Assert.assertEquals(1, capturedMpIds.getValue().size());
  // And if it was the correct one
  Assert.assertEquals(MP_ID, capturedMpIds.getValue().iterator().next());
  // Check if status in db was updated
  TranscriptionJobControl job = database.findByJob(JOB_ID);
  Assert.assertNotNull(job);
  Assert.assertEquals(TranscriptionJobControl.Status.Closed.name(), job.getStatus());
}