
de.bechte.junit.runners.context.statements.builder.FailOnTimeoutStatementBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of junit-hierarchicalcontextrunner Show documentation
Show all versions of junit-hierarchicalcontextrunner Show documentation
This is a runner implementation that supports context hierarchies in JUnit. For more
details please visit: https://github.com/bechte/junit-hierarchicalcontextrunner/wiki
package de.bechte.junit.runners.context.statements.builder;
import org.junit.Test;
import org.junit.internal.runners.statements.FailOnTimeout;
import org.junit.runner.Description;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement;
import org.junit.runners.model.TestClass;
/**
* The {@link FailOnTimeoutStatementBuilder} creates a {@link FailOnTimeout} statement for the timeout given in the
* {@code @Test} annotation. If no timeout is specified, the builder returns the provided next {@link Statement}.
* @deprecated The {@code timeout} field of the {@code @Test} annotation is deprecated. Therefore, this builder is
* also marked as deprecated. Please make use of the {@code @Rule} annotation.
*/
@Deprecated
public class FailOnTimeoutStatementBuilder implements MethodStatementBuilder {
public Statement createStatement(final TestClass testClass, final FrameworkMethod method, final Object target,
final Statement next, final Description description, final RunNotifier notifier) {
final Test annotation = method.getAnnotation(Test.class);
return annotation.timeout() <= 0 ? next : new FailOnTimeout(next, annotation.timeout());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy