List of usage examples for junit.framework TestResult errors
public synchronized Enumeration<TestFailure> errors()
From source file:org.fhcrc.cpl.toolbox.filehandler.TabLoader.java
public static void main(String[] args) throws Exception { try {/*from w ww .j av a 2 s . com*/ Class c = Class.forName("org.fhcrc.cpas.data.ConvertHelper"); c.getMethod("registerHelpers").invoke(null); Test test = TabLoaderTestCase.suite(); TestResult result = new TestResult(); test.run(result); System.out.println(result.wasSuccessful() ? "success" : "fail"); Enumeration failures = result.failures(); Throwable first = null; while (failures.hasMoreElements()) { TestFailure failure = (TestFailure) failures.nextElement(); System.err.println(failure.toString()); if (first == null) first = failure.thrownException(); } Enumeration errors = result.errors(); while (errors.hasMoreElements()) { TestFailure error = (TestFailure) errors.nextElement(); System.err.println(error.toString()); if (first == null) first = error.thrownException(); } if (first != null) { System.err.println("first exception"); first.printStackTrace(System.err); } } catch (Throwable t) { t.printStackTrace(System.err); } }