public class JavaFileWriter extends java.lang.Object implements CodeWriter
CodeWriter that writes JUnit4 test class source text to a .java file with
annotations so that tests are executed in ascending alphabetical order by test method name.| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
dirName
The directory to which JUnit files are written.
|
| Constructor and Description |
|---|
JavaFileWriter(java.lang.String junitDirName)
JavaFileWriter creates an instance of class holding information needed to write a test suite.
|
| Modifier and Type | Method and Description |
|---|---|
private java.nio.file.Path |
createOutputDir(java.lang.String packageName)
Create the output directory for the package if it does not already exist.
|
private java.nio.file.Path |
getDir(java.lang.String packageName)
Returns the directory for the package name relative to the directory name of this writer.
|
java.nio.file.Path |
writeClassCode(java.lang.String packageName,
java.lang.String className,
java.lang.String classCode)
writeClassCode writes a code sequence as a JUnit4 test class to a .java file.
|
java.nio.file.Path |
writeUnmodifiedClassCode(java.lang.String packageName,
java.lang.String classname,
java.lang.String classCode)
Writes the given class.
|
private final java.lang.String dirName
public JavaFileWriter(java.lang.String junitDirName)
junitDirName - directory where files are to be writtenpublic java.nio.file.Path writeClassCode(java.lang.String packageName,
java.lang.String className,
java.lang.String classCode)
throws RandoopOutputException
writeClassCode in interface CodeWriterpackageName - the package name for the classclassName - the name of the classclassCode - the source text of the test classRandoopOutputException - if there is an error while writing the codepublic java.nio.file.Path writeUnmodifiedClassCode(java.lang.String packageName,
java.lang.String classname,
java.lang.String classCode)
throws RandoopOutputException
CodeWriterwriteUnmodifiedClassCode in interface CodeWriterpackageName - the package name of the classclassname - the simple name of the classclassCode - the text of the class to be written, must be compilablePath object for the Java file writtenRandoopOutputException - if there is an error while writing the codeprivate java.nio.file.Path createOutputDir(java.lang.String packageName)
throws RandoopOutputException
packageName - the package namePath for the created directoryRandoopOutputException - if the directory for the package could not be createdprivate java.nio.file.Path getDir(java.lang.String packageName)
packageName - the package namePath for the directory corresponding to the package name