@Test
  public void testImportUnrecognizedError() throws Exception {
    List<MediaAlbum> albums =
        ImmutableList.of(new MediaAlbum("id1", "album1.", "This is a fake albumb"));

    MediaContainerResource data =
        new MediaContainerResource(albums, null /*photos*/, null /*videos*/);

    Call call = mock(Call.class);
    doReturn(call)
        .when(client)
        .newCall(
            argThat(
                (Request r) ->
                    r.url()
                        .toString()
                        .equals("https://www.baseurl.com/v1.0/me/drive/special/photos/children")));
    Response response =
        fakeErrorResponse(
                500,
                "" /*httpMessage*/,
                "{\"message\": \"Hippo is the best dog, not a real-world response\"}")
            .build();
    when(call.execute()).thenReturn(response);

    ImportResult result = importer.importItem(uuid, executor, authData, data);
    assertThat(executor.getErrors().size()).isEqualTo(1);
    String exception =
        executor.getErrors().stream().map(e -> e.exception()).collect(Collectors.toList()).get(0);
    assertThat(exception).contains(CAUSE_PREFIX_UNRECOGNIZED_EXCEPTION);
  }
This tests the MicrosoftMediaImporter. As of now, it only tests the number of requests called.
More tests are needed to test request bodies and parameters.
extensions/data-transfer/portability-data-transfer-microsoft/src/test/java/org/datatransferproject/transfer/microsoft/media/MicrosoftMediaImporterTest.java