@Test
  public void oddBuilderContext() {
    JavaFileObject autoValueClass =
        JavaFileObjects.forSourceLines(
            "foo.bar.Baz",
            "package foo.bar;",
            "",
            "import com.google.auto.value.AutoValue;",
            "import com.google.common.collect.ImmutableList;",
            "",
            "@AutoValue",
            "abstract class Baz {",
            "  abstract String string();",
            "",
            "  @AutoValue.Builder",
            "  abstract static class Builder {",
            "    abstract Builder setString(String x);",
            "    abstract Baz oddBuild();",
            "    Baz build(int butNotReallyBecauseOfThisParameter) {",
            "      return null;",
            "    }",
            "  }",
            "}");
    ContextChecker checker =
        context -> {
          assertThat(context.builder()).isPresent();
          BuilderContext builderContext = context.builder().get();
          assertThat(builderContext.builderMethods()).isEmpty();
          assertThat(builderContext.toBuilderMethods()).isEmpty();
          assertThat(builderContext.buildMethod()).isEmpty();
          assertThat(builderContext.autoBuildMethod().getSimpleName().toString())
              .isEqualTo("oddBuild");

          Map<String, Set<ExecutableElement>> setters = builderContext.setters();
          assertThat(setters.keySet()).containsExactly("string");
          Set<ExecutableElement> thingSetters = setters.get("string");
          assertThat(thingSetters).hasSize(1);
          ExecutableElement thingSetter = Iterables.getOnlyElement(thingSetters);
          assertThat(thingSetter.getSimpleName().toString()).isEqualTo("setString");

          assertThat(builderContext.propertyBuilders()).isEmpty();
        };
    ContextCheckingExtension extension = new ContextCheckingExtension(checker);
    Compilation compilation =
        javac()
            .withProcessors(new AutoValueProcessor(ImmutableList.of(extension)))
            .compile(autoValueClass);
    assertThat(compilation).succeededWithoutWarnings();
  }
Tests that extensions providing their own implemented annotation types or options get picked
up.
value/src/test/java/com/google/auto/value/processor/ExtensionTest.java