@Test
  public void exportAlbumWithoutNextPage() throws IOException {
    // Setup
    MicrosoftDriveItem folderItem = setUpSingleAlbum();
    when(driveItemsResponse.getDriveItems()).thenReturn(new MicrosoftDriveItem[] {folderItem});
    when(driveItemsResponse.getNextPageLink()).thenReturn(null);
    StringPaginationToken inputPaginationToken =
        new StringPaginationToken(DRIVE_TOKEN_PREFIX + DRIVE_PAGE_URL);

    // Run
    ExportResult<MediaContainerResource> result = microsoftMediaExporter.exportOneDrivePhotos(
        null, Optional.empty(), Optional.of(inputPaginationToken), uuid);

    // Verify method calls
    verify(mediaInterface).getDriveItems(Optional.empty(), Optional.of(DRIVE_PAGE_URL));
    verify(driveItemsResponse).getDriveItems();

    // Verify next pagination token is absent
    ContinuationData continuationData = result.getContinuationData();
    StringPaginationToken paginationToken =
        (StringPaginationToken) continuationData.getPaginationData();
    assertThat(paginationToken).isEqualTo(null);

    // Verify one album is ready for import
    Collection<MediaAlbum> actualAlbums = result.getExportedData().getAlbums();
    assertThat(actualAlbums.stream().map(MediaAlbum::getId).collect(Collectors.toList()))
        .containsExactly(FOLDER_ID);

    // Verify photos should be empty (in the root)
    Collection<PhotoModel> actualPhotos = result.getExportedData().getPhotos();
    assertThat(actualPhotos).isEmpty();

    // Verify there is one container ready for sub-processing
    List<ContainerResource> actualResources = continuationData.getContainerResources();
    assertThat(actualResources.stream()
                   .map(a -> ((IdOnlyContainerResource) a).getId())
                   .collect(Collectors.toList()))
        .containsExactly(FOLDER_ID);
  }
Unit tests of Microsoft onedrive exporter for Media models.
extensions/data-transfer/portability-data-transfer-microsoft/src/test/java/org/datatransferproject/transfer/microsoft/media/MicrosoftMediaExporterTest.java