package org.eclipse.birt.report.tests.viewer;

import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import junit.framework.Test;
import junit.framework.TestSuite;

/**
 *  All test cases for tests viewer
 */
public class AllTests extends utility.BaseTestCase
{

	/**
	 * @return test cases in the suite.
	 */
	public static Test suite( )
	{
		
		TestSuite suite = new TestSuite(
				"Test for org.eclipse.birt.report.tests.viewer" ); //$NON-NLS-1$

		List classes = new ArrayList( );
		AllTests allTests = new AllTests( );

		// Add test packages.
		
		classes.addAll( allTests
				.getClasses( "org.eclipse.birt.report.tests.viewer.regression" ) ); //$NON-NLS-1$
		
		Iterator iter = classes.iterator( );
		while ( iter.hasNext( ) )
		{
			String next = (String) iter.next( );
			try
			{
				Class c = Class.forName( next );
				int modifier = c.getModifiers( );
				if ( Modifier.isPublic( modifier )
						&& !Modifier.isStatic( modifier ) )
				{
					suite.addTestSuite( c );
				}
			}
			catch ( ClassNotFoundException e )
			{
				assert false;
			}
		}

		return suite;
	}
}