Class JavaSourcesSubject
java.lang.Object
com.google.common.truth.Subject<JavaSourcesSubject, Iterable<? extends JavaFileObject>>
com.google.testing.compile.JavaSourcesSubject
- All Implemented Interfaces:
CompileTester, ProcessedCompileTesterFactory
public final class JavaSourcesSubject
extends com.google.common.truth.Subject<JavaSourcesSubject, Iterable<? extends JavaFileObject>>
implements CompileTester, ProcessedCompileTesterFactory
A Truth
Subject that evaluates the result
of a javac compilation. See com.google.testing.compile for usage examples- Author:
- Gregory Kick
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.google.common.truth.Subject
com.google.common.truth.Subject.Factory<SubjectT,ActualT> Nested classes/interfaces inherited from interface CompileTester
CompileTester.ChainingClause<T>, CompileTester.CleanCompilationClause, CompileTester.ColumnClause<T>, CompileTester.CompilationWithNotesClause<T>, CompileTester.CompilationWithWarningsClause<T>, CompileTester.FileClause<T>, CompileTester.GeneratedPredicateClause<T>, CompileTester.LineClause<T>, CompileTester.SuccessfulCompilationClause, CompileTester.SuccessfulFileClause<T>, CompileTester.UnsuccessfulCompilationClause -
Method Summary
Modifier and TypeMethodDescriptionstatic JavaSourcesSubjectassertThat(JavaFileObject javaFileObject) static JavaSourcesSubjectassertThat(JavaFileObject javaFileObject, JavaFileObject... javaFileObjects) The clause in the fluent API that tests for successful compilation without errors.The clause in the fluent API that tests for successful compilation without warnings or errors.The clause in the fluent API that tests for unsuccessful compilation.voidparsesAs(JavaFileObject first, JavaFileObject... rest) The clause in the fluent API that tests that the code parses equivalently to the specified code.processedWith(Iterable<? extends Processor> processors) Adds annotation processors to the compilation being tested.processedWith(Processor first, Processor... rest) Adds annotation processors to the compilation being tested.withClasspath(Iterable<File> classPath) Sets the compilation classpath.withClasspathFrom(ClassLoader classLoader) Deprecated.withCompilerOptions(Iterable<String> options) Adds options that will be passed to the compiler.withCompilerOptions(String... options) Adds options that will be passed to the compiler.Methods inherited from class com.google.common.truth.Subject
actual, actualAsString, actualCustomStringRepresentation, check, equals, fail, fail, fail, failComparing, failComparing, failWithBadResults, failWithCustomSubject, failWithoutActual, failWithoutSubject, failWithRawMessage, failWithRawMessageAndCause, getDisplaySubject, getSubject, hashCode, ignoreCheck, internalCustomName, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, named
-
Method Details
-
withCompilerOptions
Description copied from interface:ProcessedCompileTesterFactoryAdds options that will be passed to the compiler.-Xlintis the first option, by default.- Specified by:
withCompilerOptionsin interfaceProcessedCompileTesterFactory
-
withCompilerOptions
Description copied from interface:ProcessedCompileTesterFactoryAdds options that will be passed to the compiler.-Xlintis the first option, by default.- Specified by:
withCompilerOptionsin interfaceProcessedCompileTesterFactory
-
withClasspathFrom
Deprecated.preferwithClasspath(Iterable). This method only supportsURLClassLoaderand the default system classloader, andFiles are usually a more natural way to expression compilation classpaths than class loaders.Description copied from interface:ProcessedCompileTesterFactoryAttempts to extract the classpath from the classpath of the Classloader argument, including all its parents up to (and including) the System Classloader.If not specified, we will use the System classpath for compilation.
- Specified by:
withClasspathFromin interfaceProcessedCompileTesterFactory
-
withClasspath
Description copied from interface:ProcessedCompileTesterFactorySets the compilation classpath.If not specified, we will use the System classpath for compilation.
- Specified by:
withClasspathin interfaceProcessedCompileTesterFactory
-
processedWith
Description copied from interface:ProcessedCompileTesterFactoryAdds annotation processors to the compilation being tested.- Specified by:
processedWithin interfaceProcessedCompileTesterFactory
-
processedWith
Description copied from interface:ProcessedCompileTesterFactoryAdds annotation processors to the compilation being tested.- Specified by:
processedWithin interfaceProcessedCompileTesterFactory
-
parsesAs
Description copied from interface:CompileTesterThe clause in the fluent API that tests that the code parses equivalently to the specified code.- Specified by:
parsesAsin interfaceCompileTester
-
compilesWithoutError
Description copied from interface:CompileTesterThe clause in the fluent API that tests for successful compilation without errors.- Specified by:
compilesWithoutErrorin interfaceCompileTester
-
compilesWithoutWarnings
Description copied from interface:CompileTesterThe clause in the fluent API that tests for successful compilation without warnings or errors.- Specified by:
compilesWithoutWarningsin interfaceCompileTester
-
failsToCompile
Description copied from interface:CompileTesterThe clause in the fluent API that tests for unsuccessful compilation.- Specified by:
failsToCompilein interfaceCompileTester
-
assertThat
-
assertThat
public static JavaSourcesSubject assertThat(JavaFileObject javaFileObject, JavaFileObject... javaFileObjects)
-
withClasspath(Iterable).