public static < E extends Exception > void possible ( double possible , Supplier < E > exceptionFactory ) throws E { if ( Math . random ( ) < possible ) { throw exceptionFactory . get ( ) ; } }
Mock exception happens by possibility