Class TagFilter



  • @API(status=STABLE,
         since="1.0")
    public final class TagFilter
    extends java.lang.Object
    Factory methods for creating PostDiscoveryFilters based on included and excluded tags or tag expressions.

    Tag expressions are boolean expressions with the following allowed operators: ! (not), & (and) and | (or). Parentheses can be used to adjust for operator precedence. Please refer to the JUnit 5 User Guide for usage examples.

    Please note that a tag name is a valid tag expression. Thus, wherever a tag expressions can be used, a tag name can be used, too.

    Since:
    1.0
    See Also:
    includeTags(String...), excludeTags(String...)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static PostDiscoveryFilter excludeTags​(java.lang.String... tagExpressions)
      Create an exclude filter based on the supplied tag expressions.
      static PostDiscoveryFilter excludeTags​(java.util.List<java.lang.String> tagExpressions)
      Create an exclude filter based on the supplied tag expressions.
      static PostDiscoveryFilter includeTags​(java.lang.String... tagExpressions)
      Create an include filter based on the supplied tag expressions.
      static PostDiscoveryFilter includeTags​(java.util.List<java.lang.String> tagExpressions)
      Create an include filter based on the supplied tag expressions.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • includeTags

        public static PostDiscoveryFilter includeTags​(java.lang.String... tagExpressions)
                                               throws PreconditionViolationException
        Create an include filter based on the supplied tag expressions.

        Containers and tests will only be executed if their tags match at least one of the supplied included tag expressions.

        Parameters:
        tagExpressions - the included tag expressions; never null or empty
        Throws:
        PreconditionViolationException - if the supplied tag expressions array is null or empty, or if any individual tag expression is not syntactically valid
        See Also:
        includeTags(List), TestTag.isValid(String)
      • includeTags

        public static PostDiscoveryFilter includeTags​(java.util.List<java.lang.String> tagExpressions)
                                               throws PreconditionViolationException
        Create an include filter based on the supplied tag expressions.

        Containers and tests will only be executed if their tags match at least one of the supplied included tag expressions.

        Parameters:
        tagExpressions - the included tag expressions; never null or empty
        Throws:
        PreconditionViolationException - if the supplied tag expressions array is null or empty, or if any individual tag expression is not syntactically valid
        See Also:
        includeTags(String...), TestTag.isValid(String)
      • excludeTags

        public static PostDiscoveryFilter excludeTags​(java.lang.String... tagExpressions)
                                               throws PreconditionViolationException
        Create an exclude filter based on the supplied tag expressions.

        Containers and tests will only be executed if their tags do not match any of the supplied excluded tag expressions.

        Parameters:
        tagExpressions - the excluded tag expressions; never null or empty
        Throws:
        PreconditionViolationException - if the supplied tag expressions array is null or empty, or if any individual tag expression is not syntactically valid
        See Also:
        excludeTags(List), TestTag.isValid(String)
      • excludeTags

        public static PostDiscoveryFilter excludeTags​(java.util.List<java.lang.String> tagExpressions)
                                               throws PreconditionViolationException
        Create an exclude filter based on the supplied tag expressions.

        Containers and tests will only be executed if their tags do not match any of the supplied excluded tag expressions.

        Parameters:
        tagExpressions - the excluded tag expressions; never null or empty
        Throws:
        PreconditionViolationException - if the supplied tag expressions array is null or empty, or if any individual tag expression is not syntactically valid
        See Also:
        excludeTags(String...), TestTag.isValid(String)