Package adams.core.option
Class FlowJUnitTestProducer
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,FileFormatHandler
,LoggingSupporter
,OptionHandler
,OptionProducer<String,String>
,OptionProducerWithOptionHandling<String,String>
,RecursiveOptionProducer
,SizeOfHandler
,Serializable
public class FlowJUnitTestProducer extends AbstractFlowJavaCodeProducer
Generates a JUnit test case for flows.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseClassname
m_ActorClass
the class for which the test is generated.protected boolean
m_HasRegressionTest
whether to create a regression test.protected BaseString[]
m_RegressionFiles
the files to use in the regression test.-
Fields inherited from class adams.core.option.AbstractJavaCodeProducer
JAVA_KEYWORDS, m_AdditionalImportsInsertLocation, m_Copyright, m_Indentation, m_JavaKeywords, m_OutputBuffer, m_OutputDefaultValues, m_Package, m_ShortenedImports, m_SimpleName, m_VarNames
-
Fields inherited from class adams.core.option.AbstractRecursiveOptionProducerWithOptionHandling
m_OptionManager
-
Fields inherited from class adams.core.option.AbstractRecursiveOptionProducer
m_Nesting
-
Fields inherited from class adams.core.option.AbstractOptionProducer
m_Input, m_LastGenerated, m_Output, m_OutputVariableValues, m_SkippedProperties, m_UsePropertyNames
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description FlowJUnitTestProducer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
actorClassTipText()
Returns the tip text for this property.protected void
addAdditionalMethods()
Hook-method for adding additional methods necessary to make the class compile.protected void
addClassJavadoc()
Adds the Javadoc for the class.protected void
addClassStart()
Adds the start of the enclosing "class" statement.protected void
addConstructor()
Adds the constructor.protected void
addCopyright()
Adds the copyright notice.protected void
addMainMethod()
Hook method for adding a main method.protected void
addMethodEnd()
Closes the method with the generated code.protected void
addMethodStart()
Adds the method that encloses the generated code.void
defineOptions()
Adds options to the internal list of options.BaseClassname
getActorClass()
Returns the name of the class to generate the test for.protected BaseClassname
getDefaultActorClass()
Returns the default actor class.boolean
getHasRegressionTest()
Returns whether to generate a regression test as well.protected String
getIndentation()
Returns the indentation for code inside the try-catch-block.BaseString[]
getRegressionFiles()
Returns the regression files to use.protected List<String>
getRequiredImports()
Returns other necessary imports.String
globalInfo()
Returns a string describing the object.String
hasRegressionTestTipText()
Returns the tip text for this property.static void
main(String[] args)
Executes the producer from commandline.protected void
preProduce()
Hook-method before starting visiting options.String
regressionFilesTipText()
Returns the tip text for this property.void
setActorClass(BaseClassname value)
Sets the class to generate the test for.void
setHasRegressionTest(boolean value)
Sets whether to create a regression test as well.void
setRegressionFiles(BaseString[] value)
Sets the regression files to use.-
Methods inherited from class adams.core.option.AbstractFlowJavaCodeProducer
getDefaultFormatExtension, getFormatDescription, getFormatExtensions, getOuterVariableName
-
Methods inherited from class adams.core.option.AbstractJavaCodeProducer
addClassEnd, addImports, addLicensePreamble, addPackage, copyrightTipText, escapeDoubleQuotes, getCast, getClassname, getClassname, getClassname, getCopyright, getCurrentVariable, getNextTmpVariable, getNextTmpVariable, getNextTmpVariable, getOutput, getOutputDefaultValues, getPackage, getSimpleName, initialize, initOutput, insertAdditionalImports, isClassName, outputDefaultValuesTipText, packageTipText, postIndent, postProduce, preIndent, preProduce, processClassOption, processOption, processOption, processOption, setCopyright, setOutputDefaultValues, setPackage, setSimpleName, shortenClassname, simpleNameTipText, toString
-
Methods inherited from class adams.core.option.AbstractRecursiveOptionProducerWithOptionHandling
cleanUpOptions, destroy, finishInit, getOptionManager, newOptionManager, toCommandLine
-
Methods inherited from class adams.core.option.AbstractRecursiveOptionProducer
cleanUp, generateLoggingString, getDebugIndentation, getDebugIndentation, getRecursionLevel, reset
-
Methods inherited from class adams.core.option.AbstractOptionProducer
checkInput, doProduce, doProduce, getCurrentValue, getInput, getOptionIdentifier, getOutputVariableValues, getSkippedProperties, getUsePropertyNames, isDefaultValue, loggingLevelTipText, outputVariableValuesTipText, postProduce, produce, produce, runProducer, setLoggingLevel, setOutputVariableValues, setSkippedProperties, toString, write
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.option.OptionProducer
cleanUp, doProduce, getInput, getLoggingLevel, getOutputVariableValues, getSkippedProperties, getUsePropertyNames, loggingLevelTipText, outputVariableValuesTipText, produce, setLoggingLevel, setOutputVariableValues, setSkippedProperties, write
-
-
-
-
Field Detail
-
m_ActorClass
protected BaseClassname m_ActorClass
the class for which the test is generated.
-
m_HasRegressionTest
protected boolean m_HasRegressionTest
whether to create a regression test.
-
m_RegressionFiles
protected BaseString[] m_RegressionFiles
the files to use in the regression test.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceOptionProducer<String,String>
- Specified by:
globalInfo
in classAbstractOptionProducer<String,String>
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options. Derived classes must override this method to add additional options.- Specified by:
defineOptions
in interfaceOptionHandler
- Specified by:
defineOptions
in interfaceOptionProducerWithOptionHandling<String,String>
- Overrides:
defineOptions
in classAbstractJavaCodeProducer
-
getDefaultActorClass
protected BaseClassname getDefaultActorClass()
Returns the default actor class.- Returns:
- the default class
-
setActorClass
public void setActorClass(BaseClassname value)
Sets the class to generate the test for.- Parameters:
value
- the class to generate the test for
-
getActorClass
public BaseClassname getActorClass()
Returns the name of the class to generate the test for.- Returns:
- the class
-
actorClassTipText
public String actorClassTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setHasRegressionTest
public void setHasRegressionTest(boolean value)
Sets whether to create a regression test as well.- Parameters:
value
- if true then a regression test is generated as well
-
getHasRegressionTest
public boolean getHasRegressionTest()
Returns whether to generate a regression test as well.- Returns:
- true if to create a regression test as well
-
hasRegressionTestTipText
public String hasRegressionTestTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRegressionFiles
public void setRegressionFiles(BaseString[] value)
Sets the regression files to use.- Parameters:
value
- the files (no path)
-
getRegressionFiles
public BaseString[] getRegressionFiles()
Returns the regression files to use.- Returns:
- the files (no path)
-
regressionFilesTipText
public String regressionFilesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getRequiredImports
protected List<String> getRequiredImports()
Returns other necessary imports.- Overrides:
getRequiredImports
in classAbstractJavaCodeProducer
- Returns:
- the class names
-
getIndentation
protected String getIndentation()
Returns the indentation for code inside the try-catch-block.- Specified by:
getIndentation
in classAbstractJavaCodeProducer
- Returns:
- the indentation string
-
addCopyright
protected void addCopyright()
Adds the copyright notice.- Overrides:
addCopyright
in classAbstractJavaCodeProducer
-
addClassJavadoc
protected void addClassJavadoc()
Adds the Javadoc for the class.- Overrides:
addClassJavadoc
in classAbstractJavaCodeProducer
-
addClassStart
protected void addClassStart()
Adds the start of the enclosing "class" statement.- Overrides:
addClassStart
in classAbstractJavaCodeProducer
-
addConstructor
protected void addConstructor()
Adds the constructor.- Overrides:
addConstructor
in classAbstractJavaCodeProducer
-
addAdditionalMethods
protected void addAdditionalMethods()
Hook-method for adding additional methods necessary to make the class compile.- Overrides:
addAdditionalMethods
in classAbstractJavaCodeProducer
-
addMethodStart
protected void addMethodStart()
Adds the method that encloses the generated code.- Specified by:
addMethodStart
in classAbstractJavaCodeProducer
-
addMethodEnd
protected void addMethodEnd()
Closes the method with the generated code.- Specified by:
addMethodEnd
in classAbstractJavaCodeProducer
-
addMainMethod
protected void addMainMethod()
Hook method for adding a main method.- Overrides:
addMainMethod
in classAbstractJavaCodeProducer
-
preProduce
protected void preProduce()
Hook-method before starting visiting options.- Overrides:
preProduce
in classAbstractFlowJavaCodeProducer
- See Also:
AbstractOptionProducer.initOutput()
-
main
public static void main(String[] args)
Executes the producer from commandline.- Parameters:
args
- the commandline arguments, use -help for help
-
-