private String runProcessor(ImmutableList<String> options, @Nullable String packageToMask)
      throws IOException {
    File tempDir = temporaryFolder.newFolder();
    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    StandardJavaFileManager standardFileManager =
        compiler.getStandardFileManager(/* diagnosticListener= */ null, /* locale= */ null, UTF_8);
    standardFileManager.setLocation(StandardLocation.CLASS_OUTPUT, ImmutableList.of(tempDir));
    StandardJavaFileManager proxyFileManager =
        Reflection.newProxy(
            StandardJavaFileManager.class,
            new FileManagerInvocationHandler(standardFileManager, packageToMask));
    CompilationTask task =
        compiler.getTask(
            /* out= */ null,
            proxyFileManager,
            /* diagnosticListener= */ null,
            options,
            /* classes= */ null,
            ImmutableList.of(
                new SimpleJavaFileObject(URI.create("test"), Kind.SOURCE) {
                  @Override
                  public CharSequence getCharContent(boolean ignoreEncodingErrors)
                      throws IOException {
                    return "class Test {}";
                  }
                }));
    task.setProcessors(ImmutableList.of(new TestProcessor()));
    assertThat(task.call()).isTrue();
    return new String(Files.readAllBytes(tempDir.toPath().resolve("G.java")), UTF_8);
  }
Run {@link TestProcessor} in a compilation with the given {@code options}, and prevent the
compilation from accessing classes with the qualified names in {@code maskFromClasspath}.
common/src/test/java/com/google/auto/common/GeneratedAnnotationsTest.java