Search in sources :

Example 1 with ExpectedExceptions

use of com.sun.tck.lib.ExpectedExceptions in project jtharness by openjdk.

the class ExceptionsExpected method getExpectedExceptionTypes.

/**
 * Returns an array of expected exception types.
 */
protected Class<? extends Throwable>[] getExpectedExceptionTypes(TestCaseContext context) {
    Class<? extends Throwable>[] expExTypes = null;
    Set<Annotation> annotations = getAnnotationsInterestedIn(context);
    for (Annotation annotation : annotations) {
        if (ExpectedExceptions.class.equals(annotation.annotationType())) {
            ExpectedExceptions exceptions = (ExpectedExceptions) annotation;
            expExTypes = exceptions.value();
            if (expExTypes.length == 0) {
                throw new SomethingIsWrong("@ExpectedExceptions attached to " + context.getTestCaseName() + " contains empty array of classes.");
            }
        }
    }
    return expExTypes;
}
Also used : SomethingIsWrong(com.sun.tck.lib.tgf.SomethingIsWrong) ExpectedExceptions(com.sun.tck.lib.ExpectedExceptions) Annotation(java.lang.annotation.Annotation)

Aggregations

ExpectedExceptions (com.sun.tck.lib.ExpectedExceptions)1 SomethingIsWrong (com.sun.tck.lib.tgf.SomethingIsWrong)1 Annotation (java.lang.annotation.Annotation)1