Package com.consol.citrus.generate
Class AbstractTestGenerator<T extends TestGenerator>
- java.lang.Object
-
- com.consol.citrus.generate.AbstractTestGenerator<T>
-
- All Implemented Interfaces:
TestGenerator<T>
- Direct Known Subclasses:
AbstractTemplateBasedTestGenerator,JavaTestGenerator
public abstract class AbstractTestGenerator<T extends TestGenerator> extends Object implements TestGenerator<T>
- Since:
- 2.7.4
- Author:
- Christoph Deppisch
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.consol.citrus.generate.TestGenerator
TestGenerator.GeneratorMode
-
-
Constructor Summary
Constructors Constructor Description AbstractTestGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAuthor()Get the test author.protected StringgetCreationDate()Get current date in special format.StringgetDescription()Get the test description.StringgetFileExtension()Gets the fileExtension.UnitFrameworkgetFramework()Get the unit test framework (usually TestNG or JUnit).protected StringgetMethodName()Construct default test method name from test name.StringgetName()Get the test name.StringgetPackage()Get the test package.StringgetSrcDirectory()Get the test source directory.protected FilegetTargetFile()Construct proper target file to save test content to.StringgetTargetPackage()Get the target package.protected StringgetUpdateDateTime()Get current date time in special format.booleanisDisabled()Gets the disabled.voidsetAuthor(String author)Set the test author.voidsetDescription(String description)Set the test description.voidsetDisabled(boolean disabled)Sets the disabled.voidsetFileExtension(String fileExtension)Sets the fileExtension.voidsetFramework(UnitFramework framework)Set the unit test framework.voidsetName(String name)Set the test name.voidsetPackage(String targetPackage)Set the test package.voidsetSrcDirectory(String srcDirectory)Set the test source directory.voidsetTargetPackage(String targetPackage)Set the target package.TusePackage(String targetPackage)Set package via builder method.TuseSrcDirectory(String srcDirectory)Set test source directory via builder method.TwithAuthor(String author)Set author via builder method.TwithDescription(String description)Set description via builder method.TwithDisabled(boolean disabled)Set the disabled state to use.TwithFileExtension(String extension)Set file extension via builder method.TwithFramework(UnitFramework framework)Set the unit testing framework to use.TwithName(String name)Set name via builder method.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.consol.citrus.generate.TestGenerator
create, getMode, withMode
-
-
-
-
Field Detail
-
log
protected org.slf4j.Logger log
Logger
-
self
protected T extends TestGenerator self
-
-
Method Detail
-
withName
public T withName(String name)
Set name via builder method.- Specified by:
withNamein interfaceTestGenerator<T extends TestGenerator>- Parameters:
name-- Returns:
-
withAuthor
public T withAuthor(String author)
Set author via builder method.- Specified by:
withAuthorin interfaceTestGenerator<T extends TestGenerator>- Parameters:
author-- Returns:
-
withDescription
public T withDescription(String description)
Set description via builder method.- Specified by:
withDescriptionin interfaceTestGenerator<T extends TestGenerator>- Parameters:
description-- Returns:
-
withFileExtension
public T withFileExtension(String extension)
Set file extension via builder method.- Parameters:
extension-- Returns:
-
usePackage
public T usePackage(String targetPackage)
Set package via builder method.- Specified by:
usePackagein interfaceTestGenerator<T extends TestGenerator>- Parameters:
targetPackage-- Returns:
-
useSrcDirectory
public T useSrcDirectory(String srcDirectory)
Set test source directory via builder method.- Specified by:
useSrcDirectoryin interfaceTestGenerator<T extends TestGenerator>- Parameters:
srcDirectory-- Returns:
-
withFramework
public T withFramework(UnitFramework framework)
Set the unit testing framework to use.- Specified by:
withFrameworkin interfaceTestGenerator<T extends TestGenerator>- Parameters:
framework-- Returns:
-
withDisabled
public T withDisabled(boolean disabled)
Set the disabled state to use.- Specified by:
withDisabledin interfaceTestGenerator<T extends TestGenerator>- Parameters:
disabled-- Returns:
-
getMethodName
protected String getMethodName()
Construct default test method name from test name.- Returns:
-
getCreationDate
protected String getCreationDate()
Get current date in special format.- Returns:
-
getUpdateDateTime
protected String getUpdateDateTime()
Get current date time in special format.- Returns:
-
getTargetFile
protected File getTargetFile()
Construct proper target file to save test content to.- Returns:
-
setName
public void setName(String name)
Set the test name.- Parameters:
name- the name to set
-
getName
public String getName()
Get the test name.- Specified by:
getNamein interfaceTestGenerator<T extends TestGenerator>- Returns:
- the name
-
setAuthor
public void setAuthor(String author)
Set the test author.- Parameters:
author- the author to set
-
getAuthor
public String getAuthor()
Get the test author.- Specified by:
getAuthorin interfaceTestGenerator<T extends TestGenerator>- Returns:
- the author
-
setDescription
public void setDescription(String description)
Set the test description.- Parameters:
description- the description to set
-
getDescription
public String getDescription()
Get the test description.- Specified by:
getDescriptionin interfaceTestGenerator<T extends TestGenerator>- Returns:
- the description
-
setPackage
public void setPackage(String targetPackage)
Set the test package.- Parameters:
targetPackage- the targetPackage to set
-
getSrcDirectory
public String getSrcDirectory()
Get the test source directory.- Returns:
- the srcDirectory
-
setSrcDirectory
public void setSrcDirectory(String srcDirectory)
Set the test source directory.- Parameters:
srcDirectory- the srcDirectory to set
-
getPackage
public String getPackage()
Get the test package.- Returns:
- the targetPackage
-
getTargetPackage
public String getTargetPackage()
Get the target package.- Specified by:
getTargetPackagein interfaceTestGenerator<T extends TestGenerator>- Returns:
- the targetPackage
-
setTargetPackage
public void setTargetPackage(String targetPackage)
Set the target package.- Parameters:
targetPackage- the targetPackage to set
-
getFramework
public UnitFramework getFramework()
Get the unit test framework (usually TestNG or JUnit).- Specified by:
getFrameworkin interfaceTestGenerator<T extends TestGenerator>- Returns:
- the framework
-
setFramework
public void setFramework(UnitFramework framework)
Set the unit test framework.- Parameters:
framework- the framework to set
-
getFileExtension
public String getFileExtension()
Gets the fileExtension.- Returns:
-
setFileExtension
public void setFileExtension(String fileExtension)
Sets the fileExtension.- Parameters:
fileExtension-
-
isDisabled
public boolean isDisabled()
Gets the disabled.- Specified by:
isDisabledin interfaceTestGenerator<T extends TestGenerator>- Returns:
-
setDisabled
public void setDisabled(boolean disabled)
Sets the disabled.- Parameters:
disabled-
-
-