/** * Adds an error to the list of errors. The passed in exception * caused the error. */ public synchronized void addError(Test test, Throwable e) { fErrors.add(new TestFailure(test, e)); for (TestListener each : cloneListeners()) { each.addError(test, e); } }
/** * Adds a failure to the list of failures. The passed in exception * caused the failure. */ public synchronized void addFailure(Test test, AssertionFailedError e) { fFailures.add(new TestFailure(test, e)); for (TestListener each : cloneListeners()) { each.addFailure(test, e); } }
/** * Informs the result that a test was completed. */ public void endTest(Test test) { for (TestListener each : cloneListeners()) { each.endTest(test); } }
/** * Informs the result that a test will be started. */ public void startTest(Test test) { final int count = test.countTestCases(); synchronized (this) { fRunTests += count; } for (TestListener each : cloneListeners()) { each.startTest(test); } }
@SuppressWarnings("unused") public void addFailure(final Test test, final Throwable t) { // pre-3.4 if (t instanceof AssertionFailedError) { testListener.addFailure(test, (AssertionFailedError) t); } else { testListener.addError(test, t); } } @Override
public void endTest(Test test) { super.endTest(test); synchronized(ParallelTestSuite.this) { core.startTest(test); // send the output out.purge(); err.purge(); // send the accumulated method calls to the actual object try { recorder.replay(core); } catch (RuntimeException e) { // must be a bug in the test result listener throw e; } catch(Error e) { throw e; } catch (Throwable e) { // impossible e.printStackTrace(); throw new InternalError(); } recorder.clear(); core.endTest(test); } } }
/** * Informs the result that a test will be started. */ public void startTest(Test test) { final int count = test.countTestCases(); synchronized (this) { fRunTests += count; } for (TestListener each : cloneListeners()) { each.startTest(test); } }
@Override public void addError(final Test test, final Throwable t) { if (junit4 && t instanceof AssertionFailedError) { // JUnit 4 does not distinguish between errors and failures // even in the JUnit 3 adapter. // So we need to help it a bit to retain compatibility for JUnit 3 tests. testListener.addFailure(test, (AssertionFailedError) t); } else if (junit4 && t instanceof AssertionError) { // Not strictly necessary but probably desirable. // JUnit 4-specific test GUIs will show just "failures". // But Ant's output shows "failures" vs. "errors". // We would prefer to show "failure" for things that logically are. final String msg = t.getMessage(); final AssertionFailedError failure = msg != null ? new AssertionFailedError(msg) : new AssertionFailedError(); failure.initCause(t.getCause()); failure.setStackTrace(t.getStackTrace()); testListener.addFailure(test, failure); } else { testListener.addError(test, t); } } @Override
/** * Adds a failure to the list of failures. The passed in exception * caused the failure. */ public synchronized void addFailure(Test test, AssertionFailedError t) { fFailures.add(new TestFailure(test, t)); for (TestListener each : cloneListeners()) { each.addFailure(test, t); } }
/** * Adds an error to the list of errors. The passed in exception * caused the error. */ public synchronized void addError(Test test, Throwable t) { fErrors.add(new TestFailure(test, t)); for (TestListener each : cloneListeners()) { each.addError(test, t); } }
/** * Informs the result that a test will be started. */ public void startTest(Test test) { final int count = test.countTestCases(); synchronized (this) { fRunTests += count; } for (TestListener each : cloneListeners()) { each.startTest(test); } }
/** * Informs the result that a test was completed. */ public void endTest(Test test) { for (TestListener each : cloneListeners()) { each.endTest(test); } }
/** * Adds a failure to the list of failures. The passed in exception * caused the failure. */ public synchronized void addFailure(Test test, AssertionFailedError t) { fFailures.add(new TestFailure(test, t)); for (TestListener each : cloneListeners()) { each.addFailure(test, t); } }
/** * Adds an error to the list of errors. The passed in exception * caused the error. */ public synchronized void addError(Test test, Throwable t) { fErrors.add(new TestFailure(test, t)); for (TestListener each : cloneListeners()) { each.addError(test, t); } }
@Override public void startTest(final Test test) { testListener.startTest(test); } };
/** * Informs the result that a test was completed. */ public void endTest(Test test) { for (TestListener each : cloneListeners()) { each.endTest(test); } }
@Override public void addFailure(final Test test, final AssertionFailedError t) { testListener.addFailure(test, t); } @SuppressWarnings("unused")
@Override public void addError(Test test, Throwable throwable) { wrapped.addError(test, throwable); }
@Override public void startTest(Test test) { wrapped.startTest(test); }
@Override public void endTest(final Test test) { testListener.endTest(test); } @Override