// Path: src/main/java/com/google/testing/compile/CompilationSubject.java
// public static CompilationSubject assertThat(Compilation actual) {
//   return assertAbout(compilations()).that(actual);
// }
// 
// Path: src/main/java/com/google/testing/compile/Compiler.java
// public static Compiler javac() {
//   return compiler(getSystemJavaCompiler());
// }


import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static com.google.testing.compile.CompilationSubject.assertThat;
import static com.google.testing.compile.Compiler.javac;
import static javax.tools.StandardLocation.SOURCE_OUTPUT;
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableList;
import javax.tools.JavaFileObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
  public void compilerStatusFailure() {
    Compiler compiler = compilerWithGenerator();
    Compilation compilation = compiler.compile(brokenSource);
    assertThat(compilation.status()).isEqualTo(Compilation.Status.FAILURE);
    assertThat(compilation.errors()).hasSize(1);
    assertThat(compilation.errors().get(0).getLineNumber()).isEqualTo(3);
  }

  @Test
  public void generatedFilePath() {
    Compiler compiler = compilerWithGenerator();
    Compilation compilation = compiler.compile(source1, source2);
    assertThat(compilation.generatedFile(SOURCE_OUTPUT, "test/generated/Blah.java")).isPresent();
  }

  @Test
  public void generatedFilePackage() {
    Compiler compiler = compilerWithGenerator();
    Compilation compilation = compiler.compile(source1, source2);
    assertThat(compilation.generatedFile(SOURCE_OUTPUT, "test.generated", "Blah.java")).isPresent();
  }

  @Test
  public void generatedSourceFile() {
    Compiler compiler = compilerWithGenerator();
    Compilation compilation = compiler.compile(source1, source2);
    assertThat(compilation.generatedSourceFile("test.generated.Blah")).isPresent();
  }

  private static Compiler compilerWithGenerator() {
// Path: src/main/java/com/google/testing/compile/CompilationSubject.java
// public static CompilationSubject assertThat(Compilation actual) {
//   return assertAbout(compilations()).that(actual);
// }
// 
// Path: src/main/java/com/google/testing/compile/Compiler.java
// public static Compiler javac() {
//   return compiler(getSystemJavaCompiler());
// }


// Path: src/test/java/com/google/testing/compile/CompilationTest.java
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static com.google.testing.compile.CompilationSubject.assertThat;
import static com.google.testing.compile.Compiler.javac;
import static javax.tools.StandardLocation.SOURCE_OUTPUT;
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableList;
import javax.tools.JavaFileObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

  public void compilerStatusFailure() {
    Compiler compiler = compilerWithGenerator();
    Compilation compilation = compiler.compile(brokenSource);
    assertThat(compilation.status()).isEqualTo(Compilation.Status.FAILURE);
    assertThat(compilation.errors()).hasSize(1);
    assertThat(compilation.errors().get(0).getLineNumber()).isEqualTo(3);
  }

  @Test
  public void generatedFilePath() {
    Compiler compiler = compilerWithGenerator();
    Compilation compilation = compiler.compile(source1, source2);
    assertThat(compilation.generatedFile(SOURCE_OUTPUT, "test/generated/Blah.java")).isPresent();
  }

  @Test
  public void generatedFilePackage() {
    Compiler compiler = compilerWithGenerator();
    Compilation compilation = compiler.compile(source1, source2);
    assertThat(compilation.generatedFile(SOURCE_OUTPUT, "test.generated", "Blah.java")).isPresent();
  }

  @Test
  public void generatedSourceFile() {
    Compiler compiler = compilerWithGenerator();
    Compilation compilation = compiler.compile(source1, source2);
    assertThat(compilation.generatedSourceFile("test.generated.Blah")).isPresent();
  }

  private static Compiler compilerWithGenerator() {
    return javac().withProcessors(new GeneratingProcessor("test.generated"));