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 BaseClassnamem_ActorClassthe class for which the test is generated.protected booleanm_HasRegressionTestwhether to create a regression test.protected BaseString[]m_RegressionFilesthe 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 StringactorClassTipText()Returns the tip text for this property.protected voidaddAdditionalMethods()Hook-method for adding additional methods necessary to make the class compile.protected voidaddClassJavadoc()Adds the Javadoc for the class.protected voidaddClassStart()Adds the start of the enclosing "class" statement.protected voidaddConstructor()Adds the constructor.protected voidaddCopyright()Adds the copyright notice.protected voidaddMainMethod()Hook method for adding a main method.protected voidaddMethodEnd()Closes the method with the generated code.protected voidaddMethodStart()Adds the method that encloses the generated code.voiddefineOptions()Adds options to the internal list of options.BaseClassnamegetActorClass()Returns the name of the class to generate the test for.protected BaseClassnamegetDefaultActorClass()Returns the default actor class.booleangetHasRegressionTest()Returns whether to generate a regression test as well.protected StringgetIndentation()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.StringglobalInfo()Returns a string describing the object.StringhasRegressionTestTipText()Returns the tip text for this property.static voidmain(String[] args)Executes the producer from commandline.protected voidpreProduce()Hook-method before starting visiting options.StringregressionFilesTipText()Returns the tip text for this property.voidsetActorClass(BaseClassname value)Sets the class to generate the test for.voidsetHasRegressionTest(boolean value)Sets whether to create a regression test as well.voidsetRegressionFiles(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:
globalInfoin interfaceOptionProducer<String,String>- Specified by:
globalInfoin 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:
defineOptionsin interfaceOptionHandler- Specified by:
defineOptionsin interfaceOptionProducerWithOptionHandling<String,String>- Overrides:
defineOptionsin 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:
getRequiredImportsin classAbstractJavaCodeProducer- Returns:
- the class names
-
getIndentation
protected String getIndentation()
Returns the indentation for code inside the try-catch-block.- Specified by:
getIndentationin classAbstractJavaCodeProducer- Returns:
- the indentation string
-
addCopyright
protected void addCopyright()
Adds the copyright notice.- Overrides:
addCopyrightin classAbstractJavaCodeProducer
-
addClassJavadoc
protected void addClassJavadoc()
Adds the Javadoc for the class.- Overrides:
addClassJavadocin classAbstractJavaCodeProducer
-
addClassStart
protected void addClassStart()
Adds the start of the enclosing "class" statement.- Overrides:
addClassStartin classAbstractJavaCodeProducer
-
addConstructor
protected void addConstructor()
Adds the constructor.- Overrides:
addConstructorin classAbstractJavaCodeProducer
-
addAdditionalMethods
protected void addAdditionalMethods()
Hook-method for adding additional methods necessary to make the class compile.- Overrides:
addAdditionalMethodsin classAbstractJavaCodeProducer
-
addMethodStart
protected void addMethodStart()
Adds the method that encloses the generated code.- Specified by:
addMethodStartin classAbstractJavaCodeProducer
-
addMethodEnd
protected void addMethodEnd()
Closes the method with the generated code.- Specified by:
addMethodEndin classAbstractJavaCodeProducer
-
addMainMethod
protected void addMainMethod()
Hook method for adding a main method.- Overrides:
addMainMethodin classAbstractJavaCodeProducer
-
preProduce
protected void preProduce()
Hook-method before starting visiting options.- Overrides:
preProducein 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
-
-