@Test
public void testCreateRecognitionsJob() throws Exception {

  service.activate(cc);
  EasyMock.expect(workspace.get(EasyMock.anyObject(URI.class))).andReturn(audioFile);
  EasyMock.replay(workspace);
  HttpEntity httpEntity = EasyMock.createNiceMock(HttpEntity.class);
  EasyMock.expect(httpEntity.getContent()).andReturn(new ByteArrayInputStream(new String("{\"id\": \"" + JOB_ID
          + "\", \"status\": \"waiting\", \"url\": \"" + WATSON_URL + "/v1/recognitions/"
          + JOB_ID + "\"}").getBytes(StandardCharsets.UTF_8)));
  CloseableHttpResponse response = EasyMock.createNiceMock(CloseableHttpResponse.class);
  StatusLine status = EasyMock.createNiceMock(StatusLine.class);
  EasyMock.expect(response.getStatusLine()).andReturn(status).anyTimes();
  EasyMock.expect(response.getEntity()).andReturn(httpEntity).anyTimes();
  EasyMock.expect(status.getStatusCode()).andReturn(HttpStatus.SC_CREATED).anyTimes();
  EasyMock.replay(httpEntity, response, status);
  Capture<HttpPost> capturedPost = Capture.newInstance();
  EasyMock.expect(httpClient.execute(EasyMock.capture(capturedPost))).andReturn(response).anyTimes();
  EasyMock.replay(httpClient);
  service.createRecognitionsJob(MP_ID, mediaPackage.getTrack("audioTrack1"));
  Assert.assertEquals(WATSON_URL + "/v1/recognitions?user_token=" + MP_ID
          + "&inactivity_timeout=-1&timestamps=true&smart_formatting=true"
          + "&callback_url=http://ADMIN_SERVER/transcripts/watson/results&events=recognitions.completed_with_results,recognitions.failed",
          capturedPost.getValue().getURI().toString());
  TranscriptionJobControl j = database.findByJob(JOB_ID);
  Assert.assertNotNull(j);
  Assert.assertEquals(MP_ID, j.getMediaPackageId());
  Assert.assertEquals(TRACK_ID, j.getTrackId());
}