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

    Collection<PhotoModel> photos =
        ImmutableList.of(
            fakeJobstoreModel(
                jobStore,
                new PhotoModel(
                    "Pic1",
                    "http://fake.com/1.jpg",
                    "A pic",
                    "image/jpg",
                    "p1", // dataId
                    "id1", // albumdId
                    true /*isInTempStore*/),
                new byte[CHUNK_SIZE]),
            fakeJobstoreModel(
                jobStore,
                new PhotoModel(
                    "Pic2",
                    "http://fake.com/2.png",
                    "fine art",
                    "image/png",
                    "p2", // dataId
                    "id1", // albumdId
                    true /*isInTempStore*/),
                new byte[CHUNK_SIZE]));
    MediaContainerResource data = new MediaContainerResource(albums, 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 = fakeResponse(200, "OK", "{\"id\": \"id1\"}").build();
    when(call.execute()).thenReturn(response);

    Call call2 = mock(Call.class);
    doReturn(call2)
        .when(client)
        .newCall(argThat((Request r) -> {
          return r.url().toString().contains("createUploadSession")
              && r.header("Authorization") != null
              && r.header("Authorization").contains("Bearer")
              && r.header("Authorization").contains(FAKE_ACCESS_TOKEN);
        }));
    Response response2 =
        fakeResponse(200, "OK", "{\"uploadUrl\": \"https://scalia.com/link\"}").build();
    when(call2.execute()).thenReturn(response2);

    Call call3 = mock(Call.class);
    doReturn(call3)
        .when(client)
        .newCall(argThat((Request r) -> {
          return r.url().toString().contains("scalia.com/link")
              // Regression coverage: we _don't_ want a token sent for every chunk.
              // https://github.com/dtinit/data-transfer-project/pull/1416
              && r.header("Authorization") == null;
        }));
    Response response3 = fakeResponse(200, "OK", "{\"id\": \"rand1\"}").build();
    when(call3.execute()).thenReturn(response3);

    ImportResult result = importer.importItem(uuid, executor, authData, data);
    verify(client, atLeast(albums.size() + photos.size())).newCall(any());
    assertThat(result).isEqualTo(ImportResult.OK);
  }
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