|
15 | 15 | */
|
16 | 16 | package com.google.auto.value.processor;
|
17 | 17 |
|
18 |
| -import static com.google.common.truth.Truth.assertAbout; |
19 |
| -import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; |
| 18 | +import static com.google.testing.compile.CompilationSubject.assertThat; |
| 19 | +import static com.google.testing.compile.Compiler.javac; |
20 | 20 |
|
21 | 21 | import com.google.common.collect.ImmutableList;
|
22 | 22 | import com.google.common.collect.ImmutableSet;
|
23 | 23 | import com.google.common.collect.ImmutableSortedSet;
|
| 24 | +import com.google.testing.compile.Compilation; |
24 | 25 | import com.google.testing.compile.JavaFileObjects;
|
25 | 26 | import java.lang.annotation.ElementType;
|
26 | 27 | import java.lang.annotation.Inherited;
|
@@ -272,13 +273,15 @@ private void assertGeneratedMatches(
|
272 | 273 | .addMethodAnnotations(expectedMethodAnnotations)
|
273 | 274 | .build();
|
274 | 275 |
|
275 |
| - assertAbout(javaSource()) |
276 |
| - .that(javaFileObject) |
277 |
| - .withCompilerOptions("-A" + Nullables.NULLABLE_OPTION + "=") |
278 |
| - .processedWith(new AutoValueProcessor()) |
279 |
| - .compilesWithoutError() |
280 |
| - .and() |
281 |
| - .generatesSources(expectedOutput); |
| 276 | + Compilation compilation = |
| 277 | + javac() |
| 278 | + .withOptions("-A" + Nullables.NULLABLE_OPTION + "=") |
| 279 | + .withProcessors(new AutoValueProcessor()) |
| 280 | + .compile(javaFileObject); |
| 281 | + assertThat(compilation).succeeded(); |
| 282 | + assertThat(compilation) |
| 283 | + .generatedSourceFile("foo.bar.AutoValue_Baz") |
| 284 | + .hasSourceEquivalentTo(expectedOutput); |
282 | 285 | }
|
283 | 286 |
|
284 | 287 | @Test
|
@@ -513,13 +516,15 @@ public void testCopyingMethodAnnotations() {
|
513 | 516 | .addFieldAnnotations("@Deprecated", "@PropertyAnnotationsTest.InheritedAnnotation")
|
514 | 517 | .build();
|
515 | 518 |
|
516 |
| - assertAbout(javaSource()) |
517 |
| - .that(inputFile) |
518 |
| - .withCompilerOptions("-A" + Nullables.NULLABLE_OPTION + "=") |
519 |
| - .processedWith(new AutoValueProcessor()) |
520 |
| - .compilesWithoutError() |
521 |
| - .and() |
522 |
| - .generatesSources(outputFile); |
| 519 | + Compilation compilation = |
| 520 | + javac() |
| 521 | + .withOptions("-A" + Nullables.NULLABLE_OPTION) |
| 522 | + .withProcessors(new AutoValueProcessor()) |
| 523 | + .compile(inputFile); |
| 524 | + assertThat(compilation).succeeded(); |
| 525 | + assertThat(compilation) |
| 526 | + .generatedSourceFile("foo.bar.AutoValue_Baz") |
| 527 | + .hasSourceEquivalentTo(outputFile); |
523 | 528 | }
|
524 | 529 |
|
525 | 530 | /**
|
@@ -552,12 +557,14 @@ public void testCopyingMethodAnnotationsToGeneratedFields() {
|
552 | 557 | "@Baz.MethodsOnly")
|
553 | 558 | .build();
|
554 | 559 |
|
555 |
| - assertAbout(javaSource()) |
556 |
| - .that(inputFile) |
557 |
| - .withCompilerOptions("-A" + Nullables.NULLABLE_OPTION + "=") |
558 |
| - .processedWith(new AutoValueProcessor()) |
559 |
| - .compilesWithoutError() |
560 |
| - .and() |
561 |
| - .generatesSources(outputFile); |
| 560 | + Compilation compilation = |
| 561 | + javac() |
| 562 | + .withOptions("-A" + Nullables.NULLABLE_OPTION + "=") |
| 563 | + .withProcessors(new AutoValueProcessor()) |
| 564 | + .compile(inputFile); |
| 565 | + assertThat(compilation).succeeded(); |
| 566 | + assertThat(compilation) |
| 567 | + .generatedSourceFile("foo.bar.AutoValue_Baz") |
| 568 | + .hasSourceEquivalentTo(outputFile); |
562 | 569 | }
|
563 | 570 | }
|
0 commit comments