public static void assertThrows(Class<?> throwable,CheckedRunnable runnable,Consumer<Throwable> exceptionConsumer){
  boolean fail=false;
  try {
    runnable.run();
    fail=true;
  }
 catch (  Throwable t) {
    if (!throwable.isInstance(t))     throw new AssertionError("Bad exception type",t);
    exceptionConsumer.accept(t);
  }
  if (fail)   Assert.fail("No exception was thrown");
}

public static void assertThrows ( Class < ? > throwable , CheckedRunnable runnable , Consumer < Throwable > exceptionConsumer ) { boolean fail = false ; try { runnable . run ( ) ; fail = true ; } catch ( Throwable t ) { if ( ! throwable . isInstance ( t ) ) throw new AssertionError ( "Bad exception type" , t ) ; exceptionConsumer . accept ( t ) ; } if ( fail ) Assert . fail ( "No exception was thrown" ) ; }
assert a throwable type and implement more assertions in a consumer
