org.etlunit.TestClasses Maven / Gradle / Ivy
package org.etlunit;
import org.etlunit.parser.ETLTestClass;
import org.etlunit.parser.ETLTestMethod;
import java.util.*;
public class TestClasses
{
private final List classes = new ArrayList();
private int testCount = 0;
public void addTestClassWithMethods(ETLTestClass cl, List methods)
{
TestClassReference tcr = new TestClassReference(cl, methods);
addReference(tcr);
}
private void addReference(TestClassReference tcr)
{
Iterator it = classes.iterator();
while (it.hasNext())
{
TestClassReference tcr2 = it.next();
if (tcr2.getTestClass().getName().equals(tcr.getTestClass().getName()))
{
throw new IllegalStateException("Test class named more than once: " + tcr.getTestClass().getName());
}
}
classes.add(tcr);
testCount += tcr.getTestMethods().size();
}
public int getTestCount()
{
return testCount;
}
public void addTestClass(ETLTestClass cl)
{
TestClassReference tcr = new TestClassReference(cl);
addReference(tcr);
}
public List getTestClassReferences()
{
return classes;
}
public void sortForTesting()
{
Collections.sort(classes, new Comparator()
{
@Override
public int compare(TestClassReference o1, TestClassReference o2)
{
String methodName1 = o1.getTestClass().getName();
String methodName2 = o2.getTestClass().getName();
return methodName1.compareTo(methodName2);
}
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy