@Before
  public void setUp() throws IOException {
    authData = mock(TokensAndUrlAuthData.class);
    clientBuilder = mock(OkHttpClient.Builder.class);
    doReturn(client).when(clientBuilder).build();
    objectMapper =
        new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    // mocked on a per test basis
    jobStore = mock(TemporaryPerJobDataStore.class);
    monitor = new ConsoleMonitor(ConsoleMonitor.Level.INFO);
    executor = new InMemoryIdempotentImportExecutor(monitor);
    credentialFactory = mock(MicrosoftCredentialFactory.class);
    credential = new Credential.Builder(BearerToken.authorizationHeaderAccessMethod()).build();
    RemoteFileStreamer remoteFileStreamer = mock(RemoteFileStreamer.class);
    when(credentialFactory.createCredential(any())).thenReturn(credential);
    when(credentialFactory.refreshCredential(any())).thenReturn(credential);
    credential.setAccessToken(FAKE_ACCESS_TOKEN);
    credential.setExpirationTimeMilliseconds(null);
    importer =
        new MicrosoftMediaImporter(
            BASE_URL,
            clientBuilder,
            objectMapper,
            jobStore,
            monitor,
            credentialFactory,
            new JobFileStream(remoteFileStreamer),
            1.0 /*maxWritesPerSecond*/);
  }
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