Search in sources :

Example 1 with ConditionalIgnore

use of org.apache.geode.test.junit.ConditionalIgnore in project geode by apache.

the class ConditionalIgnoreRule method throwOnIgnoreTest.

protected Statement throwOnIgnoreTest(Statement statement, Description description) {
    if (isTest(description)) {
        boolean ignoreTest = false;
        String message = "";
        ConditionalIgnore testCaseAnnotation = description.getAnnotation(ConditionalIgnore.class);
        if (testCaseAnnotation != null) {
            ignoreTest = evaluate(testCaseAnnotation, description);
            message = testCaseAnnotation.value();
        } else if (description.getTestClass().isAnnotationPresent(ConditionalIgnore.class)) {
            ConditionalIgnore testClassAnnotation = description.getTestClass().getAnnotation(ConditionalIgnore.class);
            ignoreTest = evaluate(testClassAnnotation, description);
            message = testClassAnnotation.value();
        }
        if (ignoreTest) {
            throw new AssumptionViolatedException(format(message, description));
        }
    }
    return statement;
}
Also used : ConditionalIgnore(org.apache.geode.test.junit.ConditionalIgnore) AssumptionViolatedException(org.junit.AssumptionViolatedException)

Aggregations

ConditionalIgnore (org.apache.geode.test.junit.ConditionalIgnore)1 AssumptionViolatedException (org.junit.AssumptionViolatedException)1