public InputStreamWrapper getInputStreamForItem(UUID jobId, DownloadableItem item)
      throws IOException {

    String fetchableUrl = item.getFetchableUrl();
    if (item.isInTempStore()) {
      return jobStore.getStream(jobId, fetchableUrl);
    }

    HttpURLConnection conn = getConnection(fetchableUrl);
    return new InputStreamWrapper(
        conn.getInputStream(), Math.max(conn.getContentLengthLong(), 0));
  }
@Test
  public void getInputStreamFromTempStore() throws Exception {
    long expectedBytes = 323;
    when(jobStore.getStream(any(), anyString())).thenReturn(
        new InputStreamWrapper(null, expectedBytes));
    boolean inTempStore = true;
    String fetchableUrl = "https://example.com";
    DownloadableItem item = new PhotoModel("title", fetchableUrl, "description", "jpeg",
        "123", "album", inTempStore);
    UUID jobId = UUID.randomUUID();
    InputStreamWrapper streamWrapper = connectionProvider.getInputStreamForItem(
        jobId, item);

    Truth.assertThat(streamWrapper.getBytes()).isEqualTo(expectedBytes);
    verify(jobStore).getStream(eq(jobId), eq(fetchableUrl));
  }