当前位置: 首页>>代码示例>>Java>>正文


Java TestDecorator类代码示例

本文整理汇总了Java中junit.extensions.TestDecorator的典型用法代码示例。如果您正苦于以下问题:Java TestDecorator类的具体用法?Java TestDecorator怎么用?Java TestDecorator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TestDecorator类属于junit.extensions包,在下文中一共展示了TestDecorator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeDescription

import junit.extensions.TestDecorator; //导入依赖的package包/类
private static Description makeDescription(Test test) {
    if (test instanceof TestCase) {
        TestCase tc = (TestCase) test;
        return Description.createTestDescription(tc.getClass(), tc.getName(),
                getAnnotations(tc));
    } else if (test instanceof TestSuite) {
        TestSuite ts = (TestSuite) test;
        String name = ts.getName() == null ? createSuiteDescription(ts) : ts.getName();
        Description description = Description.createSuiteDescription(name);
        int n = ts.testCount();
        for (int i = 0; i < n; i++) {
            Description made = makeDescription(ts.testAt(i));
            description.addChild(made);
        }
        return description;
    } else if (test instanceof Describable) {
        Describable adapter = (Describable) test;
        return adapter.getDescription();
    } else if (test instanceof TestDecorator) {
        TestDecorator decorator = (TestDecorator) test;
        return makeDescription(decorator.getTest());
    } else {
        // This is the best we can do in this case
        return Description.createSuiteDescription(test.getClass());
    }
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:27,代码来源:JUnit38ClassRunner.java

示例2: makeDescription

import junit.extensions.TestDecorator; //导入依赖的package包/类
private static Description makeDescription(Test test) {
    if (test instanceof TestCase) {
        TestCase tc = (TestCase) test;
        return Description.createTestDescription(tc.getClass(), tc.getName());
    } else if (test instanceof TestSuite) {
        TestSuite ts = (TestSuite) test;
        String name = ts.getName() == null ? createSuiteDescription(ts) : ts.getName();
        Description description = Description.createSuiteDescription(name);
        int n = ts.testCount();
        for (int i = 0; i < n; i++) {
            Description made = makeDescription(ts.testAt(i));
            description.addChild(made);
        }
        return description;
    } else if (test instanceof Describable) {
        Describable adapter = (Describable) test;
        return adapter.getDescription();
    } else if (test instanceof TestDecorator) {
        TestDecorator decorator = (TestDecorator) test;
        return makeDescription(decorator.getTest());
    } else {
        // This is the best we can do in this case
        return Description.createSuiteDescription(test.getClass());
    }
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:26,代码来源:JUnit38ClassRunner.java

示例3: getName

import junit.extensions.TestDecorator; //导入依赖的package包/类
public String getName() {
	if (isJUnit4TestCaseAdapter(fTest)) {
		Method method = (Method) callJUnit4GetterMethod(fTest, "getTestMethod"); //$NON-NLS-1$
		return MessageFormat.format(MessageIds.TEST_IDENTIFIER_MESSAGE_FORMAT, method.getName(), method.getDeclaringClass().getName());
	}
	if (fTest instanceof TestCase) {
		TestCase testCase = (TestCase) fTest;
		return MessageFormat.format(MessageIds.TEST_IDENTIFIER_MESSAGE_FORMAT, testCase.getName(), fTest.getClass().getName());
	}
	if (fTest instanceof TestSuite) {
		TestSuite suite = (TestSuite) fTest;
		if (suite.getName() != null)
			return suite.getName();
		return suite.getClass().getName();
	}
	if (fTest instanceof TestDecorator) {
		TestDecorator decorator = (TestDecorator) fTest;
		return decorator.getClass().getName();
	}
	if (isJUnit4TestSuiteAdapter(fTest)) {
		Class testClass = (Class) callJUnit4GetterMethod(fTest, "getTestClass"); //$NON-NLS-1$
		return testClass.getName();
	}
	return fTest.toString();
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:26,代码来源:JUnit3TestReference.java

示例4: sendTree

import junit.extensions.TestDecorator; //导入依赖的package包/类
public void sendTree(final IVisitsTestTrees notified) {
	if (fTest instanceof TestDecorator) {
		TestDecorator decorator = (TestDecorator) fTest;
		notified.visitTreeEntry(getIdentifier(), true, 1);
		sendTreeOfChild(decorator.getTest(), notified);
	} else if (fTest instanceof TestSuite) {
		TestSuite suite = (TestSuite) fTest;
		notified.visitTreeEntry(getIdentifier(), true, suite.testCount());
		for (int i = 0; i < suite.testCount(); i++) {
			sendTreeOfChild(suite.testAt(i), notified);
		}
	} else if (isJUnit4TestSuiteAdapter(fTest)) {
		notified.visitTreeEntry(getIdentifier(), true, fTest.countTestCases());
		List tests = (List) callJUnit4GetterMethod(fTest, "getTests"); //$NON-NLS-1$
		for (Iterator iter = tests.iterator(); iter.hasNext();) {
			sendTreeOfChild((Test) iter.next(), notified);
		}
	} else {
		notified.visitTreeEntry(getIdentifier(), false, fTest.countTestCases());
	}
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:22,代码来源:JUnit3TestReference.java

示例5: doPrioritize

import junit.extensions.TestDecorator; //导入依赖的package包/类
private void doPrioritize(final Test suite, final List path) {
	if (suite instanceof TestCase) {
		TestCase testCase = (TestCase) suite;
		if (hasPriority(testCase))
			reorder(testCase, path);
	} else if (suite instanceof TestSuite) {
		TestSuite aSuite = (TestSuite) suite;
		path.add(suite);
		loopTests(path, aSuite);
		path.remove(path.size() - 1);
	} else if (suite instanceof TestDecorator) {
		TestDecorator aDecorator = (TestDecorator) suite;
		path.add(aDecorator);
		doPrioritize(aDecorator.getTest(), path);
		path.remove(path.size() - 1);
	}
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:18,代码来源:FailuresFirstPrioritizer.java

示例6: seekTests

import junit.extensions.TestDecorator; //导入依赖的package包/类
private void seekTests(Test test) {
	if (test instanceof TestSuite) {
		seekTests((TestSuite) test);
	} else if (test instanceof TestCase) {
		seekTests((TestCase) test);
	} else if (test instanceof TestDecorator) {
		seekTests(((TestDecorator) test).getTest());
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:SomeTests.java

示例7: plansDecoratorCorrectly

import junit.extensions.TestDecorator; //导入依赖的package包/类
@Test
public void plansDecoratorCorrectly() {
    JUnit38ClassRunner runner = new JUnit38ClassRunner(new TestDecorator(new TestSuite(MyTest.class)));
    assertEquals(1, runner.testCount());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:6,代码来源:JUnit38ClassRunnerTest.java


注:本文中的junit.extensions.TestDecorator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。