本文整理汇总了Java中junit.framework.TestSuite.tests方法的典型用法代码示例。如果您正苦于以下问题:Java TestSuite.tests方法的具体用法?Java TestSuite.tests怎么用?Java TestSuite.tests使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类junit.framework.TestSuite
的用法示例。
在下文中一共展示了TestSuite.tests方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iterateTests
import junit.framework.TestSuite; //导入方法依赖的package包/类
private void iterateTests(TestResult result, StringBuffer times, TestSuite suite, AtomicLong min, AtomicLong max) {
Enumeration en = suite.tests();
while (en.hasMoreElements()) {
Test t = (Test)en.nextElement();
if (t instanceof Callable) {
try {
Long v = (Long)((Callable) t).call();
long time = v.longValue();
if (time < min.longValue()) {
min.set(time);
}
if (time > max.longValue()) {
max.set(time);
}
// append(t.toString()).append(" value: ")
times.append("Run: ").append(v).append('\n');
} catch (Exception ex) {
result.addError(this, ex);
}
}
if (t instanceof TestSuite) {
iterateTests(result, times, (TestSuite)t, min, max);
}
}
}
示例2: collectTests
import junit.framework.TestSuite; //导入方法依赖的package包/类
private static void collectTests(Test test, ArrayList<Object[]> tests) {
if (test instanceof TestSuite) {
TestSuite suite = (TestSuite) test;
Enumeration<Test> tests2 = suite.tests();
while (tests2.hasMoreElements()) {
Test test2 = tests2.nextElement();
collectTests(test2, tests);
}
} else {
String name;
if (test instanceof IHasFullname) {
name = ((IHasFullname) test).getFullName();
} else {
name = ((TestCase) test).getName();
}
tests.add(new Object[] { test, name });
}
}
示例3: makeSuiteForTesterClass
import junit.framework.TestSuite; //导入方法依赖的package包/类
protected TestSuite makeSuiteForTesterClass(Class<? extends AbstractTester<?>> testerClass) {
final TestSuite candidateTests = new TestSuite(testerClass);
final TestSuite suite = filterSuite(candidateTests);
Enumeration<?> allTests = suite.tests();
while (allTests.hasMoreElements()) {
Object test = allTests.nextElement();
if (test instanceof AbstractTester) {
@SuppressWarnings("unchecked")
AbstractTester<? super G> tester = (AbstractTester<? super G>) test;
tester.init(subjectGenerator, name, setUp, tearDown);
}
}
return suite;
}
示例4: filterSuite
import junit.framework.TestSuite; //导入方法依赖的package包/类
private TestSuite filterSuite(TestSuite suite) {
TestSuite filtered = new TestSuite(suite.getName());
final Enumeration<?> tests = suite.tests();
while (tests.hasMoreElements()) {
Test test = (Test) tests.nextElement();
if (matches(test)) {
filtered.addTest(test);
}
}
return filtered;
}
示例5: createExampleSuite
import junit.framework.TestSuite; //导入方法依赖的package包/类
@GwtIncompatible // suite sub call
private static TestSuite createExampleSuite(ListExample example) {
TestSuite resultSuite = new TestSuite(ListsImplTest.class);
for (Enumeration<Test> testEnum = resultSuite.tests(); testEnum.hasMoreElements();) {
ListsImplTest test = (ListsImplTest) testEnum.nextElement();
test.example = example;
}
return resultSuite;
}