public class CompilableTestPredicate extends java.lang.Object implements java.io.Closeable, java.util.function.Predicate<ExecutableSequence>
TestPredicate that returns true if the given ExecutableSequence is compilable.| Modifier and Type | Field and Description |
|---|---|
private NameGenerator |
classNameGenerator
The name generator for temporary class names.
|
private SequenceCompiler |
compiler
The compiler for sequence code.
|
private GenTests |
genTests
The
GenTests instance that created this predicate. |
private JUnitCreator |
junitCreator
The
JUnitCreator to generate a class from a ExecutableSequence |
private NameGenerator |
methodNameGenerator
The name generator for test method names.
|
| Constructor and Description |
|---|
CompilableTestPredicate(JUnitCreator junitCreator,
GenTests genTests)
Creates a predicate using the given
JUnitCreator to construct the test class for each
sequence. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Releases resources held by this.
|
boolean |
test(ExecutableSequence eseq) |
(package private) boolean |
testSource(java.lang.String testClassName,
com.github.javaparser.ast.CompilationUnit source,
java.lang.String packageName)
Return true if the given source code compiles without error.
|
private final SequenceCompiler compiler
private final JUnitCreator junitCreator
JUnitCreator to generate a class from a ExecutableSequenceprivate final NameGenerator classNameGenerator
private final NameGenerator methodNameGenerator
public CompilableTestPredicate(JUnitCreator junitCreator, GenTests genTests)
JUnitCreator to construct the test class for each
sequence.junitCreator - the JUnitCreator for this Randoop rungenTests - the GenTests instance to report compilation failurespublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic boolean test(ExecutableSequence eseq)
Indicate whether the given sequence is compilable.
test in interface java.util.function.Predicate<ExecutableSequence>boolean testSource(java.lang.String testClassName,
com.github.javaparser.ast.CompilationUnit source,
java.lang.String packageName)
ExecutableSequence, which may not always be possible.testClassName - the name of the test classsource - the source text for the classpackageName - the package name for the test, null if no package