@VisibleForTesting
  ExportResult<VideosContainerResource> exportVideos(
      TokensAndUrlAuthData authData, Optional<StringPaginationToken> paginationData, UUID jobId)
      throws IOException {

    Optional<String> paginationToken = paginationData.map(StringPaginationToken::getToken);

    MediaItemSearchResponse mediaItemSearchResponse =
        getOrCreateVideosInterface(authData).listVideoItems(paginationToken);

    PaginationData nextPageData = null;
    if (!Strings.isNullOrEmpty(mediaItemSearchResponse.getNextPageToken())) {
      nextPageData = new StringPaginationToken(mediaItemSearchResponse.getNextPageToken());
    }
    ContinuationData continuationData = new ContinuationData(nextPageData);

    VideosContainerResource containerResource = null;
    GoogleMediaItem[] mediaItems = mediaItemSearchResponse.getMediaItems();
    if (mediaItems != null && mediaItems.length > 0) {
      List<VideoModel> videos = convertVideosList(mediaItems, jobId);
      containerResource = new VideosContainerResource(null, videos);
    }

    ResultType resultType = ResultType.CONTINUE;
    if (nextPageData == null) {
      resultType = ResultType.END;
    }

    return new ExportResult<>(resultType, containerResource, continuationData);
  }
@Test
  public void exportSingleVideo() throws IOException {
    when(albumListResponse.getNextPageToken()).thenReturn(null);
    GoogleMediaItem mediaItem = setUpSingleVideo(VIDEO_URI, VIDEO_ID);
    when(mediaItemSearchResponse.getMediaItems()).thenReturn(new GoogleMediaItem[]{mediaItem});
    when(mediaItemSearchResponse.getNextPageToken()).thenReturn(VIDEO_TOKEN);

    // Run test
    ExportResult<VideosContainerResource> result =
            googleVideosExporter.exportVideos(null, Optional.empty(), uuid);


    // Verify correct methods were called
    verify(videosInterface).listVideoItems(Optional.empty());
    verify(mediaItemSearchResponse).getMediaItems();

    // Check pagination
    ContinuationData continuationData = result.getContinuationData();
    StringPaginationToken paginationToken =
            (StringPaginationToken) continuationData.getPaginationData();
    assertThat(paginationToken.getToken()).isEqualTo(VIDEO_TOKEN);

    // Check videos field of container
    Collection<VideoModel> actualVideos = result.getExportedData().getVideos();

    URI video_uri_object = null;
    try {
      video_uri_object = new URI(VIDEO_URI + "=dv");
    } catch (URISyntaxException e) {
      e.printStackTrace();
    }

    assertThat(actualVideos.stream().map(VideoModel::getContentUrl).collect(Collectors.toList()))
            .containsExactly(video_uri_object);
    // Since albums are not supported atm, this should be null
    assertThat(actualVideos.stream().map(VideoModel::getAlbumId).collect(Collectors.toList()))
            .containsExactly((Object) null);
  }