@Test
  public void testExport() throws Exception {
    server.enqueue(new MockResponse().setBody(CALENDARS_RESPONSE));
    server.enqueue(new MockResponse().setBody(CALENDAR1_EVENTS_RESPONSE));
    server.enqueue(new MockResponse().setBody(CALENDAR2_EVENTS_RESPONSE));

    server.start();

    HttpUrl baseUrl = server.url("");
    MicrosoftCalendarExporter exporter =
        new MicrosoftCalendarExporter(baseUrl.toString(), client, mapper, transformerService);

    ExportResult<CalendarContainerResource> resource = exporter
        .export(UUID.randomUUID(), token, Optional.empty());

    CalendarContainerResource calendarResource = resource.getExportedData();

    assertEquals(2, calendarResource.getCalendars().size());
    assertFalse(
        calendarResource
            .getCalendars()
            .stream()
            .anyMatch(c -> "Calendar1".equals(c.getId()) && "Calendar2".equals(c.getId())));

    assertEquals(2, calendarResource.getEvents().size());
    assertFalse(
        calendarResource
            .getEvents()
            .stream()
            .anyMatch(
                e ->
                    "Test Appointment 1".equals(e.getTitle())
                        && "Test Appointment 2".equals(e.getTitle())));
  }
Verifies Calendar export using mock HTTP endpoints that replay responses from the Microsoft Graph
API.
extensions/data-transfer/portability-data-transfer-microsoft/src/test/java/org/datatransferproject/transfer/microsoft/integration/MicrosoftCalendarExportTest.java