@Override
  public ExportResult<CalendarContainerResource> export(
      UUID jobId, TokensAndUrlAuthData authData, Optional<ExportInformation> exportInformation) {
    if (!exportInformation.isPresent()) {
      return exportCalendars(authData, Optional.empty());
    } else {
      StringPaginationToken paginationToken =
          (StringPaginationToken) exportInformation.get().getPaginationData();
      if (paginationToken != null && paginationToken.getToken().startsWith(CALENDAR_TOKEN_PREFIX)) {
        // Next thing to export is more calendars
        return exportCalendars(authData, Optional.of(paginationToken));
      } else {
        // Next thing to export is events
        IdOnlyContainerResource idOnlyContainerResource =
            (IdOnlyContainerResource) exportInformation.get().getContainerResource();
        Optional<PaginationData> pageData = Optional.ofNullable(paginationToken);
        return getCalendarEvents(authData,
            idOnlyContainerResource.getId(),
            pageData);
      }
    }
  }
@Test
  public void exportCalendarSubsequentSet() throws IOException {
    setUpSingleCalendarResponse();

    // Looking at subsequent page, with no page after it
    PaginationData paginationData = new StringPaginationToken(CALENDAR_TOKEN_PREFIX + NEXT_TOKEN);
    ExportInformation exportInformation = new ExportInformation(paginationData, null);
    calendarListResponse.setNextPageToken(null);

    // Run test
    ExportResult<CalendarContainerResource> result =
        googleCalendarExporter.export(UUID.randomUUID(), null, Optional.of(exportInformation));

    // Check results
    // Verify correct calls were made
    InOrder inOrder = Mockito.inOrder(calendarListRequest);
    inOrder.verify(calendarListRequest).setPageToken(NEXT_TOKEN);
    inOrder.verify(calendarListRequest).execute();

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