@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 exportEventFirstSet() throws IOException {
    setUpSingleEventResponse();

    // Looking at first page, with at least one page after it
    ContainerResource containerResource = new IdOnlyContainerResource(CALENDAR_ID);
    ExportInformation exportInformation = new ExportInformation(null, containerResource);
    eventListResponse.setNextPageToken(NEXT_TOKEN);

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

    // Check results
    // Verify correct methods were called
    verify(calendarEvents).list(CALENDAR_ID);
    verify(eventListRequest).setMaxAttendees(MAX_ATTENDEES);
    verify(eventListRequest).execute();

    // Check events
    Collection<CalendarEventModel> actualEvents = result.getExportedData().getEvents();
    assertThat(
            actualEvents
                .stream()
                .map(CalendarEventModel::getCalendarId)
                .collect(Collectors.toList()))
        .containsExactly(CALENDAR_ID);
    assertThat(actualEvents.stream().map(CalendarEventModel::getTitle).collect(Collectors.toList()))
        .containsExactly(EVENT_DESCRIPTION);

    // Check pagination token
    ContinuationData continuationData = (ContinuationData) result.getContinuationData();
    StringPaginationToken paginationToken =
        (StringPaginationToken) continuationData.getPaginationData();
    assertThat(paginationToken.getToken()).isEqualTo(EVENT_TOKEN_PREFIX + NEXT_TOKEN);
  }