public Filter createGroupFilter()

in surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FilterFactory.java [62:96]


    public Filter createGroupFilter(Map<String, String> providerProperties) {
        String groups = providerProperties.get(TESTNG_GROUPS_PROP);

        GroupMatcher included = null;
        if (isNotBlank(groups)) {
            try {
                included = new GroupMatcherParser(groups).parse();
            } catch (ParseException e) {
                throw new IllegalArgumentException(
                        "Invalid group expression: '" + groups + "'. Reason: " + e.getMessage(), e);
            }
        }

        String excludedGroups = providerProperties.get(TESTNG_EXCLUDEDGROUPS_PROP);

        GroupMatcher excluded = null;
        if (isNotBlank(excludedGroups)) {
            try {
                excluded = new GroupMatcherParser(excludedGroups).parse();
            } catch (ParseException e) {
                throw new IllegalArgumentException(
                        "Invalid group expression: '" + excludedGroups + "'. Reason: " + e.getMessage(), e);
            }
        }

        if (included != null && testClassLoader != null) {
            included.loadGroupClasses(testClassLoader);
        }

        if (excluded != null && testClassLoader != null) {
            excluded.loadGroupClasses(testClassLoader);
        }

        return new GroupMatcherCategoryFilter(included, excluded);
    }