@VisibleForTesting // TODO(aksingh737,jzacsh) stop exposing this to unit tests
  public long importPhotos(Collection<PhotoModel> photos, GPhotosUpload gPhotosUpload)
      throws Exception {
    return gPhotosUpload.uploadItemsViaBatching(photos, this::importPhotoBatch);
  }
@Test
  public void importPhotoInTempStoreFailure() throws Exception {
    PhotoModel photoModel =
        new PhotoModel(
            PHOTO_TITLE,
            IMG_URI,
            PHOTO_DESCRIPTION,
            JPEG_MEDIA_TYPE,
            "oldPhotoID1",
            OLD_ALBUM_ID,
            true);

    Mockito.when(googlePhotosInterface.uploadMediaContent(any(), eq(null)))
        .thenThrow(new IOException("Unit Testing"));
    JobStore jobStore = Mockito.mock(LocalJobStore.class);
    Mockito.when(jobStore.getStream(any(), any()))
        .thenReturn(
            new TemporaryPerJobDataStore.InputStreamWrapper(
                new ByteArrayInputStream("TestingBytes".getBytes())));
    Mockito.doNothing().when(jobStore).removeData(any(), anyString());

    ConnectionProvider connectionProvider = new ConnectionProvider(jobStore);
    GooglePhotosImporter googlePhotosImporter =
        new GooglePhotosImporter(
            null, jobStore, null, null, googlePhotosInterface, connectionProvider, null, 1.0);

    BatchMediaItemResponse batchMediaItemResponse =
        new BatchMediaItemResponse(
            new NewMediaItemResult[] {buildMediaItemResult("token1", Code.OK_VALUE)});

    Mockito.when(googlePhotosInterface.createPhotos(any(NewMediaItemUpload.class)))
        .thenReturn(batchMediaItemResponse);

    UUID jobId = UUID.randomUUID();

    googlePhotosImporter.importPhotos(Lists.newArrayList(photoModel), new GPhotosUpload(jobId, executor,
        Mockito.mock(TokensAndUrlAuthData.class)));
    Mockito.verify(jobStore, Mockito.times(0)).removeData(any(), anyString());
    Mockito.verify(jobStore, Mockito.times(1)).getStream(any(), anyString());
  }