/* 109: */ /* 110: */ private static Description makeDescription(Test test) /* 111: */ { /* 112: 96 */ if ((test instanceof TestCase)) /* 113: */ { /* 114: 97 */ TestCase tc = (TestCase) test; /* 115: 98 */ return Description.createTestDescription(tc.getClass(), tc.getName()); /* 116: */ } /* 117: 99 */ if ((test instanceof TestSuite)) /* 118: */ { /* 119:100 */ TestSuite ts = (TestSuite) test; /* 120:101 */ String name = ts.getName() == null ? createSuiteDescription(ts) : ts.getName(); /* 121:102 */ Description description = Description.createSuiteDescription(name, new Annotation[0]); /* 122:103 */ int n = ts.testCount(); /* 123:104 */ for (int i = 0; i < n; i++) /* 124: */ { /* 125:105 */ Description made = makeDescription(ts.testAt(i)); /* 126:106 */ description.addChild(made); /* 127: */ } /* 128:108 */ return description; /* 129: */ } /* 130:109 */ if ((test instanceof Describable)) /* 131: */ { /* 132:110 */ Describable adapter = (Describable) test; /* 133:111 */ return adapter.getDescription(); /* 134: */ } /* 135:112 */ if ((test instanceof TestDecorator)) /* 136: */ { /* 137:113 */ TestDecorator decorator = (TestDecorator) test; /* 138:114 */ return makeDescription(decorator.getTest()); /* 139: */ } /* 140:117 */ return Description.createSuiteDescription(test.getClass()); /* 141: */ }
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()); } }