public static boolean checkAllMethodReturnTrue ( final Object instance , final List < Method > methods ) { boolean res = true ; if ( ! methods . isEmpty ( ) ) { for ( final Method method : methods ) { Object returnValue ; try { returnValue = method . invoke ( instance ) ; res &= returnValue instanceof Boolean && ( ( Boolean ) returnValue ) . booleanValue ( ) ; } catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { res = false ; } } } return res ; }
Check if all given methods return true or if the list is empty .