aboutsummaryrefslogtreecommitdiff
path: root/value/src/test/java/com/google
diff options
context:
space:
mode:
authorÉamonn McManus <emcmanus@google.com>2021-05-25 15:56:47 -0700
committerGoogle Java Core Libraries <java-libraries-firehose+copybara@google.com>2021-05-25 15:57:20 -0700
commit54baeb3e4ffbf1a4ad403c3386eaf462620fe6a1 (patch)
tree31c1443c036fec5926593a1248bbf62b1d0123f1 /value/src/test/java/com/google
parentc84e6affef24a0d390b5fb7415c3b3ebd246fac3 (diff)
downloadauto-54baeb3e4ffbf1a4ad403c3386eaf462620fe6a1.tar.gz
Update an AutoValue test to the newer compile-testing API.
RELNOTES=n/a PiperOrigin-RevId: 375814417
Diffstat (limited to 'value/src/test/java/com/google')
-rw-r--r--value/src/test/java/com/google/auto/value/processor/PropertyAnnotationsTest.java53
1 files changed, 30 insertions, 23 deletions
diff --git a/value/src/test/java/com/google/auto/value/processor/PropertyAnnotationsTest.java b/value/src/test/java/com/google/auto/value/processor/PropertyAnnotationsTest.java
index 0ada36bb..8092aa93 100644
--- a/value/src/test/java/com/google/auto/value/processor/PropertyAnnotationsTest.java
+++ b/value/src/test/java/com/google/auto/value/processor/PropertyAnnotationsTest.java
@@ -15,12 +15,13 @@
*/
package com.google.auto.value.processor;
-import static com.google.common.truth.Truth.assertAbout;
-import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource;
+import static com.google.testing.compile.CompilationSubject.assertThat;
+import static com.google.testing.compile.Compiler.javac;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
+import com.google.testing.compile.Compilation;
import com.google.testing.compile.JavaFileObjects;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
@@ -272,13 +273,15 @@ public class PropertyAnnotationsTest {
.addMethodAnnotations(expectedMethodAnnotations)
.build();
- assertAbout(javaSource())
- .that(javaFileObject)
- .withCompilerOptions("-A" + Nullables.NULLABLE_OPTION + "=")
- .processedWith(new AutoValueProcessor())
- .compilesWithoutError()
- .and()
- .generatesSources(expectedOutput);
+ Compilation compilation =
+ javac()
+ .withOptions("-A" + Nullables.NULLABLE_OPTION + "=")
+ .withProcessors(new AutoValueProcessor())
+ .compile(javaFileObject);
+ assertThat(compilation).succeeded();
+ assertThat(compilation)
+ .generatedSourceFile("foo.bar.AutoValue_Baz")
+ .hasSourceEquivalentTo(expectedOutput);
}
@Test
@@ -513,13 +516,15 @@ public class PropertyAnnotationsTest {
.addFieldAnnotations("@Deprecated", "@PropertyAnnotationsTest.InheritedAnnotation")
.build();
- assertAbout(javaSource())
- .that(inputFile)
- .withCompilerOptions("-A" + Nullables.NULLABLE_OPTION + "=")
- .processedWith(new AutoValueProcessor())
- .compilesWithoutError()
- .and()
- .generatesSources(outputFile);
+ 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);
}
/**
@@ -552,12 +557,14 @@ public class PropertyAnnotationsTest {
"@Baz.MethodsOnly")
.build();
- assertAbout(javaSource())
- .that(inputFile)
- .withCompilerOptions("-A" + Nullables.NULLABLE_OPTION + "=")
- .processedWith(new AutoValueProcessor())
- .compilesWithoutError()
- .and()
- .generatesSources(outputFile);
+ 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);
}
}