@VisibleForTesting
  ExportResult<MusicContainerResource> exportPlaylistItems(
      TokensAndUrlAuthData authData,
      IdOnlyContainerResource playlistData,
      Optional<PaginationData> paginationData, UUID jobId)
      throws IOException, InvalidTokenException, PermissionDeniedException, ParseException {
    String playlistId = playlistData.getId();
    Optional<String> paginationToken =
        paginationData.map((PaginationData value) -> ((StringPaginationToken) value).getToken());

    PlaylistItemExportResponse playlistItemExportResponse =
        getOrCreateMusicHttpApi(authData).exportPlaylistItems(playlistId, paginationToken);

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

    MusicContainerResource containerResource = null;
    GooglePlaylistItem[] googlePlaylistItems = playlistItemExportResponse.getPlaylistItems();
    List<MusicPlaylistItem> playlistItems = new ArrayList<>();
    if (googlePlaylistItems != null && googlePlaylistItems.length > 0) {
      for (GooglePlaylistItem googlePlaylistItem : googlePlaylistItems) {
        playlistItems.add(convertPlaylistItem(playlistId, googlePlaylistItem));
        monitor.debug(
            () ->
                String.format(
                    "%s: Google Music exporting playlist item in %s : [track title: %s, track isrc: %s]",
                    jobId, playlistId,
                    googlePlaylistItem.getTrack().getTitle(),
                    googlePlaylistItem.getTrack().getIsrc()));
      }
      containerResource = new MusicContainerResource(null, playlistItems, null, null);
    }

    return new ExportResult<>(ResultType.CONTINUE, containerResource, continuationData);
  }
@Test
  public void exportPlaylistItemSubsequentSet()
      throws IOException, InvalidTokenException, PermissionDeniedException, ParseException {
    GooglePlaylistItem playlistItem = setUpSinglePlaylistItem("t1_isrc", "r1_icpn");
    when(playlistItemExportResponse.getPlaylistItems())
        .thenReturn(new GooglePlaylistItem[]{playlistItem});
    when(playlistItemExportResponse.getNextPageToken()).thenReturn(null);

    StringPaginationToken inputPaginationToken = new StringPaginationToken(PLAYLIST_ITEM_TOKEN);
    IdOnlyContainerResource idOnlyContainerResource = new IdOnlyContainerResource("p1_id");

    // Run test
    ExportResult<MusicContainerResource> result =
        googleMusicExporter.exportPlaylistItems(
            null, idOnlyContainerResource, Optional.of(inputPaginationToken), uuid);

    // Check results
    // Verify correct methods were called
    verify(musicHttpApi).exportPlaylistItems("p1_id", Optional.of(PLAYLIST_ITEM_TOKEN));
    verify(playlistItemExportResponse).getPlaylistItems();

    // Check pagination token
    ContinuationData continuationData = result.getContinuationData();
    PaginationData paginationToken = continuationData.getPaginationData();
    assertThat(paginationToken).isNull();
  }