public Filter createGroupFilter( Properties providerProperties )
{
String groups = providerProperties.getProperty( ProviderParameterNames.TESTNG_GROUPS_PROP );
String excludedGroups = providerProperties.getProperty( ProviderParameterNames.TESTNG_EXCLUDEDGROUPS_PROP );
GroupMatcher included = null;
if ( groups != null && groups.trim().length() > 0 )
{
try
{
included = new GroupMatcherParser( groups ).parse();
}
catch ( ParseException e )
{
throw new IllegalArgumentException(
"Invalid group expression: '" + groups + "'. Reason: " + e.getMessage(), e );
}
}
GroupMatcher excluded = null;
if ( excludedGroups != null && excludedGroups.trim().length() > 0 )
{
try
{
excluded = new GroupMatcherParser( excludedGroups ).parse();
}
catch ( ParseException e )
{
throw new IllegalArgumentException(
"Invalid group expression: '" + excludedGroups + "'. Reason: " + e.getMessage(), e );
}
}
// GroupMatcher included = commaSeparatedListToFilters( groups );
// GroupMatcher excluded = commaSeparatedListToFilters( excludedGroups );
if ( included != null && testClassLoader != null )
{
included.loadGroupClasses( testClassLoader );
}
if ( excluded != null && testClassLoader != null )
{
excluded.loadGroupClasses( testClassLoader );
}
return new GroupMatcherCategoryFilter( included, excluded );
}