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()); } }
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()); } }
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()); } }
/** * Tests if the node is a TestSuite. */ TestSuite isTestSuite(Object node) { if (node instanceof TestSuite) return (TestSuite)node; if (node instanceof TestDecorator) { Test baseTest= ((TestDecorator)node).getTest(); return isTestSuite(baseTest); } return null; }
private void doPrioritize(Test suite, 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); } }
public void sendTree(IVisitsTestTrees notified) { if (fTest instanceof TestDecorator) { TestDecorator decorator= (TestDecorator) fTest; notified.visitTreeEntry(getIdentifier(), true, 1, false, "-1"); //$NON-NLS-1$ sendTreeOfChild(decorator.getTest(), notified); } else if (fTest instanceof TestSuite) { TestSuite suite= (TestSuite) fTest; notified.visitTreeEntry(getIdentifier(), true, suite.testCount(), false, "-1"); //$NON-NLS-1$ for (int i= 0; i < suite.testCount(); i++) { sendTreeOfChild(suite.testAt(i), notified); } } else if (isJUnit4TestSuiteAdapter(fTest)) { List tests= (List) callJUnit4GetterMethod(fTest, "getTests"); //$NON-NLS-1$ notified.visitTreeEntry(getIdentifier(), true, tests.size(), false, "-1"); //$NON-NLS-1$ for (Iterator iter= tests.iterator(); iter.hasNext();) { sendTreeOfChild((Test) iter.next(), notified); } } else { notified.visitTreeEntry(getIdentifier(), false, fTest.countTestCases(), false, "-1"); //$NON-NLS-1$ } }
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()); } }
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()); } }
private Description makeDescription(Test test) { if (test instanceof TestCase) { TestCase tc= (TestCase) test; //FIXME When test constructed fail then tc.getClass() returns junit.framework.TestSuite.1 that created in TestSuite.warring() 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()); } }
private Description makeDescription(Test test) { if (test instanceof TestCase) { TestCase tc= (TestCase) test; //FIXME When test constructed fail then tc.getClass() returns junit.framework.TestSuite.1 that created in TestSuite.warring() 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()); } }
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()); } }
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()); } }
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()); } }