private Statement possiblyExpectingExceptions(FrameworkMethod testMethod,
Object test, Statement next) {
@SuppressWarnings("unchecked") Class<? extends Throwable> expectedException =
(Class<? extends Throwable>) getAnnotationValue(testMethod.getAnnotation(Test.class.getName()), "expected");
if (expectedException != null && !expectedException.getName().equals(org.junit.Test.None.class.getName())) {
return new ExpectExceptionStatement(next, expectedException);
} else {
return next;
}
}