public abstract class AbstractJGivenConfiguration extends java.lang.Object implements FormatterConfiguration
Constructor and Description |
---|
AbstractJGivenConfiguration() |
Modifier and Type | Method and Description |
---|---|
abstract void |
configure() |
TagConfiguration.Builder |
configureTag(java.lang.Class<? extends java.lang.annotation.Annotation> tagAnnotation)
Configures the given annotation as a tag.
|
Formatter<?> |
getFormatter(java.lang.Class<?> typeToBeFormatted) |
TagConfiguration |
getTagConfiguration(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType) |
java.lang.String |
getTestClassSuffixRegEx() |
<T> void |
setFormatter(java.lang.Class<T> typeToBeFormatted,
Formatter<T> formatter)
Sets the formatter for the given type.
|
void |
setTestClassSuffixRegEx(java.lang.String suffixRegEx)
Set a regular expression for a test class suffix that should be removed by JGiven in the report.
|
public final TagConfiguration.Builder configureTag(java.lang.Class<? extends java.lang.annotation.Annotation> tagAnnotation)
IsTag
annotation.tagAnnotation
- the tag to be configuredpublic abstract void configure()
public TagConfiguration getTagConfiguration(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
public <T> void setFormatter(java.lang.Class<T> typeToBeFormatted, Formatter<T> formatter)
When choosing a formatter, JGiven will take the formatter defined for the most specific super type of a given type.
If no formatter can be found for a type, the DefaultFormatter
is taken.
For example, given the following formatter are defined:
setFormatter( Object.class, formatterA ); setFormatter( String.class, formatterB );When formatting a String,
formatterB
will be taken.
If formatter for multiple super types of a type are defined, but these types have no subtype relation, then an arbitrary formatter is taken in a non-deterministic way. Thus you should avoid this situation.
For example, given the following formatter are defined:
setFormatter( Cloneable.class, formatterA ); setFormatter( Serializable.class, formatterB );When formatting a String,
formatterA
or formatterB
will be taken non-deterministically.
The order in which the formatter are defined, does not make a difference.
Note that the formatter can still be overridden by using a formatting annotation.
typeToBeFormatted
- the type for which the formatter should be definedformatter
- the formatter to format instances of that typepublic void setTestClassSuffixRegEx(java.lang.String suffixRegEx)
By default the regular expression is Tests?
suffixRegEx
- a regular expression that match the suffixpublic Formatter<?> getFormatter(java.lang.Class<?> typeToBeFormatted)
getFormatter
in interface FormatterConfiguration
public java.lang.String getTestClassSuffixRegEx()