Class CompilationRule

java.lang.Object
com.google.testing.compile.CompilationRule
All Implemented Interfaces:
org.junit.rules.TestRule

public final class CompilationRule extends Object implements org.junit.rules.TestRule
A JUnit4 Rule that executes tests such that a instances of Elements and Types are available during execution.

To use this rule in a test, just add the following field:

@Rule public CompilationRule compilationRule = new CompilationRule();
Author:
Gregory Kick
  • Constructor Details

    • CompilationRule

      public CompilationRule()
  • Method Details

    • apply

      public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
      Specified by:
      apply in interface org.junit.rules.TestRule
    • getElements

      public Elements getElements()
      Returns the Elements instance associated with the current execution of the rule.
      Throws:
      IllegalStateException - if this method is invoked outside the execution of the rule.
    • getTypes

      public Types getTypes()
      Returns the Types instance associated with the current execution of the rule.
      Throws:
      IllegalStateException - if this method is invoked outside the execution of the rule.