### Question:
GoogleContactsExporter implements Exporter<TokensAndUrlAuthData, ContactsModelWrapper> { @Override public ExportResult<ContactsModelWrapper> export( UUID jobId, TokensAndUrlAuthData authData, Optional<ExportInformation> exportInformation) { if (exportInformation.isPresent()) { StringPaginationToken stringPaginationToken = (StringPaginationToken) exportInformation.get().getPaginationData(); return exportContacts(authData, Optional.ofNullable(stringPaginationToken)); } else { return exportContacts(authData, Optional.empty()); } } GoogleContactsExporter(GoogleCredentialFactory credentialFactory); @VisibleForTesting  GoogleContactsExporter(PeopleService peopleService); @Override ExportResult<ContactsModelWrapper> export(
      UUID jobId, TokensAndUrlAuthData authData, Optional<ExportInformation> exportInformation);  }### Answer:
@Test public void exportFirstPage() throws IOException { setUpSinglePersonResponse(); listConnectionsResponse.setNextPageToken(NEXT_PAGE_TOKEN); ExportResult<ContactsModelWrapper> result = contactsService.export(UUID.randomUUID(), null, Optional.empty()); verify(connections).list(SELF_RESOURCE); InOrder inOrder = Mockito.inOrder(getBatchGet); inOrder.verify(getBatchGet).setResourceNames(Collections.singletonList(RESOURCE_NAME)); inOrder.verify(getBatchGet).setPersonFields(PERSON_FIELDS); inOrder.verify(getBatchGet).execute(); ContinuationData continuationData = (ContinuationData) result.getContinuationData(); assertThat(continuationData.getContainerResources()).isEmpty(); StringPaginationToken paginationToken = (StringPaginationToken) ((ContinuationData) result.getContinuationData()).getPaginationData(); assertThat(paginationToken.getToken()).isEqualTo(NEXT_PAGE_TOKEN); JCardReader reader = new JCardReader(result.getExportedData().getVCards()); List<VCard> vCardList = reader.readAll(); assertThat(vCardList.size()).isEqualTo(connectionsList.size()); }
@Test public void exportSubsequentPage() throws IOException { setUpSinglePersonResponse(); PaginationData paginationData = new StringPaginationToken(NEXT_PAGE_TOKEN); ExportInformation exportInformation = new ExportInformation(paginationData, null); listConnectionsResponse.setNextPageToken(null); when(listConnectionsRequest.setPageToken(NEXT_PAGE_TOKEN)).thenReturn(listConnectionsRequest); ExportResult<ContactsModelWrapper> result = contactsService.export(UUID.randomUUID(), null, Optional.of(exportInformation)); InOrder inOrder = Mockito.inOrder(listConnectionsRequest); inOrder.verify(listConnectionsRequest).setPageToken(NEXT_PAGE_TOKEN); inOrder.verify(listConnectionsRequest).execute(); ContinuationData continuationData = (ContinuationData) result.getContinuationData(); assertThat(continuationData.getContainerResources()).isEmpty(); assertThat(continuationData.getPaginationData()).isNull(); }