@Test
public void testWorkflowDispatcherJobNotFound() throws Exception {

  service.activate(cc);
  CloseableHttpResponse response = EasyMock.createNiceMock(CloseableHttpResponse.class);
  StatusLine status = EasyMock.createNiceMock(StatusLine.class);
  EasyMock.expect(response.getStatusLine()).andReturn(status).anyTimes();
  EasyMock.expect(status.getStatusCode()).andReturn(HttpStatus.SC_NOT_FOUND).anyTimes();
  EasyMock.replay(response, status);
  Capture<HttpGet> capturedGet = Capture.newInstance();
  EasyMock.expect(httpClient.execute(EasyMock.capture(capturedGet))).andReturn(response).anyTimes();
  EasyMock.replay(httpClient);
  database.storeJobControl(MP_ID, TRACK_ID, JOB_ID, TranscriptionJobControl.Status.InProgress.name(), 0, DATE_EXPECTED, PROVIDER);
  EasyMock.replay(workspace);
  WorkflowDispatcher dispatcher = service.new WorkflowDispatcher();
  dispatcher.run();
  // Check if it called the external service to get the results
  Assert.assertEquals(WATSON_URL + "/v1/recognitions/" + JOB_ID,
          capturedGet.getValue().getURI().toString());
  // Check if the job status was updated and email was sent
  TranscriptionJobControl j = database.findByJob(JOB_ID);
  Assert.assertNotNull(j);
  Assert.assertEquals(TranscriptionJobControl.Status.Canceled.toString(), j.getStatus());
  EasyMock.verify(smtpService);
}