Package com.google.testing.compile.Compilation

Examples of com.google.testing.compile.Compilation.Result


      return new SuccessfulCompilationBuilder(result);
    }

    @Override
    public UnsuccessfulCompilationClause failsToCompile() {
      Result result = Compilation.compile(processors, getSubject());
      if (result.successful()) {
        String message = Joiner.on('\n').join(
            "Compilation was expected to fail, but contained no errors.",
            "",
            reportFilesGenerated(result));
        failureStrategy.fail(message);
View Full Code Here


  @Override
  public Statement apply(final Statement base, Description description) {
    return new Statement() {
      @Override public void evaluate() throws Throwable {
        final AtomicReference<Throwable> thrown = new AtomicReference<Throwable>();
        Result result = Compilation.compile(ImmutableList.of(new AbstractProcessor() {
          @Override
          public SourceVersion getSupportedSourceVersion() {
            return SourceVersion.latest();
          }

          @Override
          public Set<String> getSupportedAnnotationTypes() {
            return ImmutableSet.of("*");
          }

          @Override
          public synchronized void init(ProcessingEnvironment processingEnv) {
            super.init(processingEnv);
            elements = processingEnv.getElementUtils();
            types = processingEnv.getTypeUtils();
          }

          @Override
          public boolean process(Set<? extends TypeElement> annotations,
              RoundEnvironment roundEnv) {
            // just run the test on the last round after compilation is over
            if (roundEnv.processingOver()) {
              try {
                base.evaluate();
              } catch (Throwable e) {
                thrown.set(e);
              }
            }
            return false;
          }
        }),
        // just compile _something_
        ImmutableList.of(JavaFileObjects.forSourceLines("Dummy", "final class Dummy {}")));
        checkState(result.successful(), result);
        Throwable t = thrown.get();
        if (t != null) {
          throw t;
        }
      }
View Full Code Here

TOP

Related Classes of com.google.testing.compile.Compilation.Result

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.