public final void run() {
   try {
     realRun();
     threadShouldThrow("InterruptedException");
   } catch (InterruptedException success) {
     threadAssertFalse(Thread.interrupted());
   } catch (Throwable t) {
     threadUnexpectedException(t);
   }
 }
 public final T call() {
   try {
     T result = realCall();
     threadShouldThrow("InterruptedException");
     return result;
   } catch (InterruptedException success) {
     threadAssertFalse(Thread.interrupted());
   } catch (Throwable t) {
     threadUnexpectedException(t);
   }
   return null;
 }
  /**
   * Extra checks that get done for all test cases.
   *
   * <p>Triggers test case failure if any thread assertions have failed, by rethrowing, in the test
   * harness thread, any exception recorded earlier by threadRecordFailure.
   *
   * <p>Triggers test case failure if interrupt status is set in the main thread.
   */
  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;
      }
    }

    if (Thread.interrupted()) throw new AssertionFailedError("interrupt status set in main thread");
  }