@Test
public void testUncaughtExceptionHandlerWithRuntimeException()
    throws InterruptedException {

  final YarnUncaughtExceptionHandler spyYarnHandler = spy(exHandler);
  final YarnRuntimeException yarnException = new YarnRuntimeException(
      "test-yarn-runtime-exception");
  final Thread yarnThread = new Thread(new Runnable() {
    @Override
    public void run() {
      throw yarnException;
    }
  });
  yarnThread.setUncaughtExceptionHandler(spyYarnHandler);
  assertSame(spyYarnHandler, yarnThread.getUncaughtExceptionHandler());
  yarnThread.start();
  yarnThread.join();
  verify(spyYarnHandler).uncaughtException(yarnThread, yarnException);
}