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

    PhotosContainerResource data = new PhotosContainerResource(albums, null);

    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 = mock(Response.class);
    ResponseBody body = mock(ResponseBody.class);
    when(body.bytes())
        .thenReturn(
            ResponseBody.create(MediaType.parse("application/json"), "{\"id\": \"id1\"}").bytes());
    when(body.string())
        .thenReturn(
            ResponseBody.create(MediaType.parse("application/json"), "{\"id\": \"id1\"}").string());
    when(response.code()).thenReturn(403);
    when(response.message()).thenReturn("Access Denied");
    when(response.body()).thenReturn(body);
    when(call.execute()).thenReturn(response);

    assertThrows(
        PermissionDeniedException.class,
        () -> {
          ImportResult result = importer.importItem(uuid, executor, authData, data);
        });
  }
This tests the MicrosoftPhotosImporter. 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/photos/MicrosoftPhotosImporterTest.java