public static void assertNoCheckedExceptionsAreThrown ( final Method method , Class < ? extends Annotation > annotation ) { Class < ? > [ ] declaredExceptions = method . getExceptionTypes ( ) ; for ( int i = 0 ; i < declaredExceptions . length ; i ++ ) { Class < ? > exception = declaredExceptions [ i ] ; if ( ! exception . isAssignableFrom ( RuntimeException . class ) ) { throw annotation == null ? MESSAGES . methodCannotThrowCheckedException ( method ) : MESSAGES . methodCannotThrowCheckedException2 ( method , annotation ) ; } } }
Asserts method don t throw checked exceptions .