@Test
public void testGetGeneratedTranscriptionNotInWorkspace() throws Exception {

  InputStream stream = GoogleSpeechTranscriptionServiceTest.class.getResourceAsStream("/" + PULLED_TRANSCRIPTION_FILE);
  database.storeJobControl(MP_ID, TRACK_ID, JOB_ID, TranscriptionJobControl.Status.InProgress.name(), TRACK_DURATION, DATE_EXPECTED, PROVIDER);
  URI uri = new URI("http://ADMIN_SERVER/collection/" + GoogleSpeechTranscriptionService.TRANSCRIPT_COLLECTION + "/"
          + JOB_ID + ".json");
  EasyMock.expect(workspace.getCollectionURI(GoogleSpeechTranscriptionService.TRANSCRIPT_COLLECTION, JOB_ID + ".json"))
          .andReturn(uri);
  EasyMock.expect(workspace.get(uri)).andThrow(new NotFoundException());
  EasyMock.expect(workspace.putInCollection(EasyMock.anyObject(String.class), EasyMock.anyObject(String.class),
          EasyMock.anyObject(InputStream.class))).andReturn(uri);
  EasyMock.replay(workspace);
  HttpEntity httpEntity = EasyMock.createNiceMock(HttpEntity.class);
  EasyMock.expect(httpEntity.getContent()).andReturn(stream);
  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_OK).anyTimes();
  EasyMock.replay(httpEntity, response, status);
  EasyMock.expect(httpClient.execute(EasyMock.anyObject(HttpGet.class))).andReturn(response).anyTimes();
  EasyMock.replay(httpClient);
  MediaPackageElement mpe = service.getGeneratedTranscription(MP_ID, JOB_ID);
  Assert.assertEquals("captions", mpe.getFlavor().getType());
  Assert.assertEquals("google-speech-json", mpe.getFlavor().getSubtype());
  Assert.assertEquals(uri.toString(), mpe.getURI().toString());
}