@Test
  public void testCopyingMethodAnnotations() {
    ImmutableSet<String> imports = getImports(PropertyAnnotationsTest.class);
    JavaFileObject inputFile =
        new InputFileBuilder()
            .setImports(imports)
            .addAnnotations(
                "@AutoValue.CopyAnnotations(exclude="
                    + "{PropertyAnnotationsTest.TestAnnotation.class})",
                "@Deprecated",
                "@PropertyAnnotationsTest.TestAnnotation",
                "@PropertyAnnotationsTest.InheritedAnnotation")
            .build();

    // Annotations are in lexicographical order of FQN:
    // @com.google.auto.value.processor.PropertyAnnotationsTest.InheritedAnnotation precedes
    // @java.lang.Deprecated
    JavaFileObject outputFile =
        new OutputFileBuilder()
            .setImports(imports)
            .addMethodAnnotations("@PropertyAnnotationsTest.InheritedAnnotation", "@Deprecated")
            .addFieldAnnotations("@PropertyAnnotationsTest.InheritedAnnotation", "@Deprecated")
            .build();

    Compilation compilation =
        javac()
            .withOptions("-A" + Nullables.NULLABLE_OPTION)
            .withProcessors(new AutoValueProcessor())
            .compile(inputFile);
    assertThat(compilation).succeeded();
    assertThat(compilation)
        .generatedSourceFile("foo.bar.AutoValue_Baz")
        .hasSourceEquivalentTo(outputFile);
  }
Tests that when CopyAnnotations is present on a method, all non-inherited annotations (except
those appearing in CopyAnnotations.exclude) are copied to the method implementation in the
generated class.
value/src/test/java/com/google/auto/value/processor/PropertyAnnotationsTest.java