public void tearDown() throws Exception {
  Throwable t=threadFailure.getAndSet(null);
  if (t != null) {
    if (t instanceof Error)     throw (Error)t;
 else     if (t instanceof RuntimeException)     throw (RuntimeException)t;
 else     if (t instanceof Exception)     throw (Exception)t;
 else {
      AssertionFailedError afe=new AssertionFailedError(t.toString());
      afe.initCause(t);
      throw afe;
    }
  }
}

public void tearDown ( ) throws Exception { Throwable t = threadFailure . getAndSet ( null ) ; if ( t != null ) { if ( t instanceof Error ) throw ( Error ) t ; else if ( t instanceof RuntimeException ) throw ( RuntimeException ) t ; else if ( t instanceof Exception ) throw ( Exception ) t ; else { AssertionFailedError afe = new AssertionFailedError ( t . toString ( ) ) ; afe . initCause ( t ) ; throw afe ; } } }
triggers test case failure if any thread assertions have failed , by rethrowing , in the test harness thread , any exception recorded earlier by threadrecordfailure .
