public static void setGroups()

in surefire-providers/surefire-testng-utils/src/main/java/org/apache/maven/surefire/testng/utils/GroupMatcherMethodSelector.java [66:99]


    public static void setGroups(String groups, String excludedGroups) {
        // System.out.println( "Processing group includes: '" + groups + "'\nExcludes: '" + excludedGroups + "'" );

        try {
            AndGroupMatcher matcher = new AndGroupMatcher();
            GroupMatcher in = null;
            if (groups != null && !groups.trim().isEmpty()) {
                in = new GroupMatcherParser(groups).parse();
            }

            if (in != null) {
                matcher.addMatcher(in);
            }

            GroupMatcher ex = null;
            if (excludedGroups != null && !excludedGroups.trim().isEmpty()) {
                ex = new GroupMatcherParser(excludedGroups).parse();
            }

            if (ex != null) {
                matcher.addMatcher(new InverseGroupMatcher(ex));
            }

            if (in != null || ex != null) {
                // System.out.println( "Group matcher: " + matcher );
                GroupMatcherMethodSelector.matcher = matcher;
            }
        } catch (ParseException e) {
            throw new IllegalArgumentException(
                    "Cannot parse group includes/excludes expression(s):\nIncludes: " + groups + "\nExcludes: "
                            + excludedGroups,
                    e);
        }
    }