protected static TestSuite getTests(Class testedClass)
{
if (!RoundtripTestBase.class.isAssignableFrom(testedClass) ||
Modifier.isAbstract(testedClass.getModifiers()))
{
throw new DdlUtilsException("Cannot create parameterized tests for class "+testedClass.getName());
}
TestSuite suite = new TestSuite();
try
{
Method[] methods = testedClass.getMethods();
PlatformInfo info = null;
RoundtripTestBase newTest;
for (int idx = 0; (methods != null) && (idx < methods.length); idx++)
{
if (methods[idx].getName().startsWith("test") &&
((methods[idx].getParameterTypes() == null) || (methods[idx].getParameterTypes().length == 0)))
{
newTest = (RoundtripTestBase)testedClass.newInstance();
newTest.setName(methods[idx].getName());
newTest.setUseDelimitedIdentifiers(false);
suite.addTest(newTest);
if (info == null)
{
info = PlatformFactory.createNewPlatformInstance(newTest.getDatabaseName()).getPlatformInfo();
}
if (info.isDelimitedIdentifiersSupported())
{
newTest = (RoundtripTestBase)testedClass.newInstance();
newTest.setName(methods[idx].getName());
newTest.setUseDelimitedIdentifiers(true);
suite.addTest(newTest);
}
}
}
}
catch (Exception ex)
{
throw new DdlUtilsException(ex);
}
return suite;
}