/** * Returns a {@link Statement}: run all non-overridden {@code @BeforeClass} methods on this class * and superclasses before executing {@code statement}; if any throws an * Exception, stop execution and pass the exception on. */ protected Statement withBeforeClasses(Statement statement) { List<FrameworkMethod> befores = testClass .getAnnotatedMethods(BeforeClass.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, null); }
/** * Returns a {@link Statement}: run all non-overridden {@code @BeforeClass} methods on this class * and superclasses before executing {@code statement}; if any throws an * Exception, stop execution and pass the exception on. */ protected Statement withBeforeClasses(Statement statement) { List<FrameworkMethod> befores = fTestClass .getAnnotatedMethods(BeforeClass.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, null); }
/** * Returns a {@link Statement}: run all non-overridden {@code @Before} * methods on this class and superclasses before running {@code next}; if * any throws an Exception, stop execution and pass the exception on. */ protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) { List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods( Before.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, target); }
/** * Returns a {@link Statement}: run all non-overridden {@code @Before} * methods on this class and superclasses before running {@code next}; if * any throws an Exception, stop execution and pass the exception on. * * @deprecated Will be private soon: use Rules instead */ @Deprecated protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) { List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods( Before.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, target); }
private Statement withBefores(Statement statement) { List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(Before.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, instance); }
new RunBefores(new Statement() { public void evaluate() {
/** * Returns a {@link Statement}: run all non-overridden {@code @BeforeClass} methods on this class * and superclasses before executing {@code statement}; if any throws an * Exception, stop execution and pass the exception on. */ protected Statement withBeforeClasses(Statement statement) { List<FrameworkMethod> befores = fTestClass .getAnnotatedMethods(BeforeClass.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, null); }
/** * Returns a {@link Statement}: run all non-overridden {@code @Before} * methods on this class and superclasses before running {@code next}; if * any throws an Exception, stop execution and pass the exception on. * * @deprecated Will be private soon: use Rules instead */ @Deprecated protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) { List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods( Before.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, target); }
/** * Returns a {@link Statement}: run all non-overridden {@code @BeforeClass} methods on this * class and superclasses before executing {@code statement}; if any throws an Exception, stop * execution and pass the exception on. * * @param statement statement * @return wrapped statement */ protected Statement withBeforeProcess(Statement statement) { TestClass testClass = getTestClass(); List<FrameworkMethod> befores = testClass.getAnnotatedMethods(BeforeProcess.class); befores.addAll(testClass.getAnnotatedMethods(BeforeClass.class)); return befores.isEmpty() ? statement : new RunBefores(statement, befores, null); }
/** * Returns a {@link Statement}: run all non-overridden {@code @BeforeClass} methods on this class * and superclasses before executing {@code statement}; if any throws an * Exception, stop execution and pass the exception on. */ protected Statement withBeforeClasses(Statement statement) { List<FrameworkMethod> befores = testClass .getAnnotatedMethods(BeforeClass.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, null); }
public static RunBefores createRunBeforesForTestInput(Statement statement, List<TupleConsumer> tupleConsumers, Tuple testInput) { return new RunBefores( statement, tupleConsumers.stream().map( frameworkMethodInvokingArgumentsFromTestCase(testInput) ).collect(toList()), null ); }
@SuppressWarnings("unchecked") @Override protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) { // We now to need to search in the class from the custom loader. //We also need to search with the annotation loaded by the custom class loader or otherwise // we don't find any method. List<FrameworkMethod> befores = testClassFromClassLoader .getAnnotatedMethods((Class<? extends Annotation>) beforeFromClassLoader); return new RunBefores(statement, befores, target); }
public Statement createStatement(final TestClass testClass, final Statement next, final Description description, final RunNotifier notifier) { final List<FrameworkMethod> befores = testClass.getAnnotatedMethods(BeforeClass.class); return befores.isEmpty() ? next : new RunBefores(next, befores, null); } }
/** * Returns a {@link Statement}: run all non-overridden {@code @BeforeClass} methods on this class * and superclasses before executing {@code statement}; if any throws an * Exception, stop execution and pass the exception on. */ protected Statement withBeforeClasses(Statement statement) { List<FrameworkMethod> befores = fTestClass .getAnnotatedMethods(BeforeClass.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, null); }
private Statement withParentBefores(Statement statement) { if (parentRunner != null) { return parentRunner.withParentBefores(new RunBefores(statement, getBefores(), delegatedRunner.currentTestObject)); } return new RunBefores(statement, getBefores(), delegatedRunner.currentTestObject); }
private Statement withLifecycleBefore(final FrameworkMethod method, final Object target, final Statement statement) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(LifecycleBefore.class); return methods.isEmpty() ? statement : new RunBefores(statement, methods, target); }
/** * Returns a {@link Statement}: run all non-overridden {@code @Before} methods on this class and superclasses before * running {@code next}; if any throws an Exception, stop execution and pass the exception on. */ protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) { List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods( Before.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, target); }
/** * Returns a {@link Statement}: run all non-overridden {@code @Before} * methods on this class and superclasses before running {@code next}; if * any throws an Exception, stop execution and pass the exception on. */ protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) { List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods( Before.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, target); }
@Override protected Statement withBeforeClasses(Statement statement) { List<FrameworkMethod> befores= getTestClass().getAnnotatedMethods(BeforeClass.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, testInstance); }
/** * Returns a {@link org.junit.runners.model.Statement}: run all non-overridden {@code @BeforeClass} methods on this class * and superclasses before executing {@code statement}; if any throws an * Exception, stop execution and pass the exception on. */ protected Statement withBeforeClasses(Statement statement) { List<FrameworkMethod> befores = getTestClass() .getAnnotatedMethods(BeforeClass.class); return befores.isEmpty() ? statement : new RunBefores(statement, befores, null); }