@SuppressWarnings("unchecked") private static <T>void assertThrows(final Consumer<Void> consumer,final Class<T> exceptionClass,final Consumer<T> assertExceptionProperties,final String message){
  final String normalizedMessage=null == message ? "" : String.format("[%s]: ",message);
  try {
    consumer.accept(null);
  }
 catch (  final Exception ex) {
    if (exceptionClass.isAssignableFrom(ex.getClass())) {
      assertExceptionProperties.accept((T)ex);
      return;
    }
    Assert.fail(String.format("%sunexpected exception of type %s was thrown: '%s'",normalizedMessage,ex.getClass(),ex.getMessage()));
  }
  Assert.fail(String.format("%sexpected exception of type %s was not thrown",normalizedMessage,exceptionClass));
}

@ SuppressWarnings ( "unchecked" ) private static < T > void assertThrows ( final Consumer < Void > consumer , final Class < T > exceptionClass , final Consumer < T > assertExceptionProperties , final String message ) { final String normalizedMessage = null == message ? "" : String . format ( "[%s]: " , message ) ; try { consumer . accept ( null ) ; } catch ( final Exception ex ) { if ( exceptionClass . isAssignableFrom ( ex . getClass ( ) ) ) { assertExceptionProperties . accept ( ( T ) ex ) ; return ; } Assert . fail ( String . format ( "%sunexpected exception of type %s was thrown: '%s'" , normalizedMessage , ex . getClass ( ) , ex . getMessage ( ) ) ) ; } Assert . fail ( String . format ( "%sexpected exception of type %s was not thrown" , normalizedMessage , exceptionClass ) ) ; }
asserts that the execution of consumer throws an exception of the specific class .
