本文整理匯總了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;
}