public final class JavaSourcesSubject extends com.google.common.truth.Subject implements CompileTester, ProcessedCompileTesterFactory
Subject that evaluates the result
of a javac compilation. See com.google.testing.compile for usage examples| Modifier and Type | Class and Description |
|---|---|
static class |
JavaSourcesSubject.SingleSourceAdapter |
com.google.common.truth.Subject.Factory<SubjectT extends com.google.common.truth.Subject,ActualT>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| Modifier and Type | Method and Description |
|---|---|
static JavaSourcesSubject |
assertThat(JavaFileObject javaFileObject) |
static JavaSourcesSubject |
assertThat(JavaFileObject javaFileObject,
JavaFileObject... javaFileObjects) |
CompileTester.SuccessfulCompilationClause |
compilesWithoutError()
The clause in the fluent API that tests for successful compilation without errors.
|
CompileTester.CleanCompilationClause |
compilesWithoutWarnings()
The clause in the fluent API that tests for successful compilation without warnings or
errors.
|
CompileTester.UnsuccessfulCompilationClause |
failsToCompile()
The clause in the fluent API that tests for unsuccessful compilation.
|
void |
parsesAs(JavaFileObject first,
JavaFileObject... rest)
The clause in the fluent API that tests that the code parses equivalently to the specified
code.
|
CompileTester |
processedWith(Iterable<? extends Processor> processors)
Adds annotation processors to the compilation being tested.
|
CompileTester |
processedWith(Processor first,
Processor... rest)
Adds annotation processors to the compilation being tested.
|
JavaSourcesSubject |
withClasspath(Iterable<File> classPath)
Sets the compilation classpath.
|
JavaSourcesSubject |
withClasspathFrom(ClassLoader classLoader)
Deprecated.
prefer
withClasspath(Iterable). This method only supports URLClassLoader and the default system classloader, and Files are usually
a more natural way to expression compilation classpaths than class loaders. |
JavaSourcesSubject |
withCompilerOptions(Iterable<String> options)
Adds options that will be passed to the compiler.
|
JavaSourcesSubject |
withCompilerOptions(String... options)
Adds options that will be passed to the compiler.
|
actualCustomStringRepresentation, check, equals, failWithActual, failWithActual, failWithoutActual, hashCode, ignoreCheck, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toStringpublic JavaSourcesSubject withCompilerOptions(Iterable<String> options)
ProcessedCompileTesterFactory-Xlint is the first option, by
default.withCompilerOptions in interface ProcessedCompileTesterFactorypublic JavaSourcesSubject withCompilerOptions(String... options)
ProcessedCompileTesterFactory-Xlint is the first option, by
default.withCompilerOptions in interface ProcessedCompileTesterFactory@Deprecated public JavaSourcesSubject withClasspathFrom(ClassLoader classLoader)
withClasspath(Iterable). This method only supports URLClassLoader and the default system classloader, and Files are usually
a more natural way to expression compilation classpaths than class loaders.ProcessedCompileTesterFactoryIf not specified, we will use the System classpath for compilation.
withClasspathFrom in interface ProcessedCompileTesterFactorypublic JavaSourcesSubject withClasspath(Iterable<File> classPath)
ProcessedCompileTesterFactoryIf not specified, we will use the System classpath for compilation.
withClasspath in interface ProcessedCompileTesterFactorypublic CompileTester processedWith(Processor first, Processor... rest)
ProcessedCompileTesterFactoryprocessedWith in interface ProcessedCompileTesterFactorypublic CompileTester processedWith(Iterable<? extends Processor> processors)
ProcessedCompileTesterFactoryprocessedWith in interface ProcessedCompileTesterFactorypublic void parsesAs(JavaFileObject first, JavaFileObject... rest)
CompileTesterparsesAs in interface CompileTester@CanIgnoreReturnValue public CompileTester.SuccessfulCompilationClause compilesWithoutError()
CompileTestercompilesWithoutError in interface CompileTester@CanIgnoreReturnValue public CompileTester.CleanCompilationClause compilesWithoutWarnings()
CompileTestercompilesWithoutWarnings in interface CompileTester@CanIgnoreReturnValue public CompileTester.UnsuccessfulCompilationClause failsToCompile()
CompileTesterfailsToCompile in interface CompileTesterpublic static JavaSourcesSubject assertThat(JavaFileObject javaFileObject)
public static JavaSourcesSubject assertThat(JavaFileObject javaFileObject, JavaFileObject... javaFileObjects)
Copyright © 2013–2022. All rights reserved.