
org.spockframework.junit4.ExceptionAdapterInterceptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spock-junit4 Show documentation
Show all versions of spock-junit4 Show documentation
Spock is a testing and specification framework for Java and Groovy applications.
What makes it stand out from the crowd is its beautiful and highly expressive specification language.
Thanks to its JUnit runner, Spock is compatible with most IDEs, build tools, and continuous integration servers.
Spock is inspired from JUnit, jMock, RSpec, Groovy, Scala, Vulcans, and other fascinating life forms.
The newest version!
package org.spockframework.junit4;
import org.spockframework.runtime.extension.*;
import org.junit.internal.AssumptionViolatedException;
import org.junit.runners.model.MultipleFailureException;
import org.opentest4j.*;
public class ExceptionAdapterInterceptor implements IMethodInterceptor {
@Override
public void intercept(IMethodInvocation invocation) throws Throwable {
try {
invocation.proceed();
} catch (AssumptionViolatedException assumption) {
throw new TestAbortedException(assumption.getMessage(), assumption);
} catch (MultipleFailureException mfe) {
throw new MultipleFailuresError("There were multiple errors", mfe.getFailures());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy