Class AbstractJGivenConfiguration

    • Constructor Detail

      • AbstractJGivenConfiguration

        public AbstractJGivenConfiguration()
    • Method Detail

      • configureTag

        public final TagConfiguration.Builder configureTag​(java.lang.Class<? extends java.lang.annotation.Annotation> tagAnnotation)
        Configures the given annotation as a tag. This is useful if you want to treat annotations as tags in JGiven that you cannot or want not to be annotated with the IsTag annotation.
        Parameters:
        tagAnnotation - the tag to be configured
        Returns:
        a configuration builder for configuring the tag
      • configure

        public abstract void configure()
      • getTagConfiguration

        public TagConfiguration getTagConfiguration​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
      • setFormatter

        public <T> void setFormatter​(java.lang.Class<T> typeToBeFormatted,
                                     Formatter<T> formatter)
        Sets the formatter for the given type.

        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,
        Then 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,
        Then either 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.

        Parameters:
        typeToBeFormatted - the type for which the formatter should be defined
        formatter - the formatter to format instances of that type
      • setTestClassSuffixRegEx

        public void setTestClassSuffixRegEx​(java.lang.String suffixRegEx)
        Set a regular expression for a test class suffix that should be removed by JGiven in the report.

        By default the regular expression is Tests?

        Parameters:
        suffixRegEx - a regular expression that match the suffix
      • getTestClassSuffixRegEx

        public java.lang.String getTestClassSuffixRegEx()