static void expectException(Class exceptionType, Runnable r) { try { r.run(); } catch e { e = unwrapTrivialExceptionWraps(e); if (!isInstance(exceptionType, e)) fail("Wrong exception type, was expecting " + exceptionType, e); silentException(e); ret; } fail("No exception thrown!"); }