@SuppressWarnings( "unchecked" )
private TestsToRun getSuitesAsList( Filter filter )
{
List<Class<?>> res = new ArrayList<Class<?>>( 500 );
TestsToRun max = scanClassPath();
if ( filter == null )
{
return max;
}
Iterator<Class<?>> it = max.iterator();
while ( it.hasNext() )
{
Class<?> clazz = it.next();
boolean isCategoryAnnotatedClass = jUnit48Reflector.isCategoryAnnotationPresent( clazz );
Description d = Description.createSuiteDescription( clazz );
if ( filter.shouldRun( d ) )
{
res.add( clazz );
}
else
{
for ( Method method : clazz.getMethods() )
{
final Description testDescription =
Description.createTestDescription( clazz, method.getName(), method.getAnnotations() );
if ( filter.shouldRun( testDescription ) )
{
res.add( clazz );
break;
}
}
}
}
return new TestsToRun( res );
}