/** Returns the name of the test method invoked by this test instance. */ public final String getTestMethodName() { return super.getName(); }
private String getName(Test test) { if (test instanceof TestCase) { return ((TestCase) test).getName(); } else { return test.toString(); } }
public String getMethodName() { return super.getName(); }
private String getName(Test test) { if (test instanceof TestCase) { return ((TestCase) test).getName(); } else { return test.toString(); } }
@Override public String getName() { return Platform.format("%s[%s]", super.getName(), suiteName); } }
/** * Returns a string representation of the test case. */ @Override public String toString() { return getName() + "(" + getClass().getName() + ")"; }
@Override public String getName() { return super.getName() + " [" + suiteName + " [" + caseDesc + "]]"; }
/** * Returns a string representation of the test case */ @Override public String toString() { return getName() + "(" + getClass().getName() + ")"; }
/** * Get the annotations associated with given TestCase. * @param test the TestCase. */ private static Annotation[] getAnnotations(TestCase test) { try { Method m = test.getClass().getMethod(test.getName()); return m.getDeclaredAnnotations(); } catch (SecurityException e) { } catch (NoSuchMethodException e) { } return new Annotation[0]; }
private static Method extractMethod(Test test) { if (test instanceof AbstractTester) { AbstractTester<?> tester = (AbstractTester<?>) test; return Helpers.getMethod(tester.getClass(), tester.getTestMethodName()); } else if (test instanceof TestCase) { TestCase testCase = (TestCase) test; return Helpers.getMethod(testCase.getClass(), testCase.getName()); } else { throw new IllegalArgumentException("unable to extract method from test: not a TestCase."); } }
@Override public String getName() { return example == null ? super.getName() : buildTestName(); }
private String buildTestName() { return super.getName() + ":" + example.getName(); }
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 String getName(Test test) { if (test instanceof TestCase) { return ((TestCase) test).getName(); } else { return test.toString(); } }
/** * Returns a string representation of the test case */ @Override public String toString() { return getName() + "(" + getClass().getName() + ")"; }
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()); } }
@Override public void startTest(Test test) { // Compensate for TestCase.toString() adding "(class)" to the end of the name String name = "" ; if ( test instanceof TestCase ) name = ((TestCase)test).getName() ; else name = test.toString() ; System.out.println("Test: "+name) ; } }
static private void addTests(TestSuite s, String dir, String base, String file) { TestCase tc = new StAX2ModelTest(dir, base, file); tc.setName("StAX " + tc.getName()); s.addTest(tc); } final String base;