
flarestar.bdd.runner.statements.PossiblyExpectExceptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bdd Show documentation
Show all versions of bdd Show documentation
Lightweight mocha/chai/jasmine BDD interface for Java tests.
The newest version!
package flarestar.bdd.runner.statements;
import flarestar.bdd.model.BddMethod;
import org.junit.Test;
import org.junit.internal.runners.statements.ExpectException;
import org.junit.runners.model.Statement;
/**
* TODO
*/
public class PossiblyExpectExceptions extends Statement {
private BddMethod method;
private Statement next;
public PossiblyExpectExceptions(BddMethod method, Statement next) {
this.method = method;
this.next = next;
}
@Override
public void evaluate() throws Throwable {
Test annotation = method.getAnnotation(Test.class);
Class extends Throwable> expectedException = Test.None.class;
if (annotation != null) {
expectedException = annotation.expected();
}
if (expectedException != Test.None.class) {
new ExpectException(next, expectedException).evaluate();
} else {
next.evaluate();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy