/** * {@inheritDoc} */ public Statement apply(Statement base, Description description) { return new RunRules(base, rulesStartingWithInnerMost, description); } }
/** * Returns a {@link Statement}: apply all non-static {@link Value} fields * annotated with {@link Rule}. * * @param statement The base statement * @return a RunRules statement if any class-level {@link Rule}s are * found, or the base statement */ private Statement withTestRules(FrameworkMethod method, List<TestRule> testRules, Statement statement) { return testRules.isEmpty() ? statement : new RunRules(statement, testRules, describeChild(method)); }
/** * Returns a {@link Statement}: apply all * static fields assignable to {@link TestRule} * annotated with {@link ClassRule}. * * @param statement the base statement * @return a RunRules statement if any class-level {@link Rule}s are * found, or the base statement */ private Statement withClassRules(Statement statement) { List<TestRule> classRules = classRules(); return classRules.isEmpty() ? statement : new RunRules(statement, classRules, getDescription()); }
/** * Returns a {@link Statement}: apply all * static fields assignable to {@link TestRule} * annotated with {@link ClassRule}. * * @param statement the base statement * @return a RunRules statement if any class-level {@link Rule}s are * found, or the base statement */ private Statement withClassRules(Statement statement) { List<TestRule> classRules = classRules(); return classRules.isEmpty() ? statement : new RunRules(statement, classRules, getDescription()); }
private Statement withRules(final TestDescriptor testCase, Statement statement) { List<TestRule> testRules = getTestClass().getAnnotatedFieldValues(instance, org.junit.Rule.class, TestRule.class); return testRules.isEmpty() ? statement : new RunRules(statement, testRules, describeChild(testCase)); }
/** * Returns a {@link Statement}: apply all non-static {@link Value} fields * annotated with {@link Rule}. * * @param statement The base statement * @return a RunRules statement if any class-level {@link Rule}s are * found, or the base statement */ private Statement withTestRules(FrameworkMethod method, List<TestRule> testRules, Statement statement) { return testRules.isEmpty() ? statement : new RunRules(statement, testRules, describeChild(method)); }
/** * Returns a {@link Statement}: apply all * static fields assignable to {@link TestRule} * annotated with {@link ClassRule}. * * @param statement the base statement * @return a RunRules statement if any class-level {@link Rule}s are * found, or the base statement */ private Statement withClassRules(Statement statement) { List<TestRule> classRules = classRules(); return classRules.isEmpty() ? statement : new RunRules(statement, classRules, getDescription()); }
private Statement withTestRules(FrameworkMethod method, List<TestRule> testRules, Statement statement) { return testRules.isEmpty() ? statement : new RunRules(statement, testRules, describeChild(method)); }
/** * Returns a {@link Statement}: apply all non-static fields annotated with {@link Rule}. * * @param statement The base statement * @return a RunRules statement if any class-level {@link Rule}s are found, or the base statement */ protected Statement withTestRules(FrameworkMethod method, List<TestRule> testRules, Statement statement) { return testRules.isEmpty() ? statement : new RunRules(statement, testRules, describeChild(method)); }
private synchronized Statement withClassRules(final Statement base, final Description description) { List<TestRule> classRules = getClassRules(); return classRules.isEmpty() ? base : new RunRules(base, classRules, description); }
private Statement applyTestRules(FrameworkMethod method, List<TestRule> testRules, Statement statement) { return testRules.isEmpty() ? statement : new RunRules(statement, testRules, describeChild(method)); }
private Statement withTestRules(FrameworkMethod method, List<TestRule> testRules, Statement statement) { return testRules.isEmpty() ? statement : new RunRules(statement, testRules, describeChild(method)); }
public Statement createStatement(final TestClass testClass, final Statement next, final Description description, final RunNotifier notifier) { final List<TestRule> classRules = new ArrayList<TestRule>(); classRules.addAll(testClass.getAnnotatedMethodValues(null, ClassRule.class, TestRule.class)); classRules.addAll(testClass.getAnnotatedFieldValues(null, ClassRule.class, TestRule.class)); return classRules.isEmpty() ? next : new RunRules(next, classRules, description); } }
private Statement withOuterRules(Statement statement, Object outerInstance) { List<TestRule> fieldRules = new TestClass(outerInstance.getClass()) .getAnnotatedFieldValues(outerInstance, Rule.class, TestRule.class); if (!fieldRules.isEmpty()) { statement = new RunRules(statement, fieldRules, null); // TODO find an example where the Rule needs a Description } return statement; }
private Statement withLifecycleRules(final FrameworkMethod method, final Object target, final Statement statement) { List<TestRule> testRules = getLifecycleRules(target); return testRules.isEmpty() ? statement : new RunRules(statement, testRules, describeChild(method)); }
protected Statement prepareRules(TestClass extension, Statement base, Description description) { List<TestRule> rules = extension.getAnnotatedFieldValues(null, Rule.class, TestRule.class); rules.addAll(extension.getAnnotatedFieldValues(null, ClassRule.class, TestRule.class)); return new RunRules(base, rules, description); }
private Statement withLifecycleRules(final FrameworkMethod method, final Object target, final Statement statement) { List<TestRule> testRules = getLifecycleRules(target); return testRules.isEmpty() ? statement : new RunRules(statement, testRules, describeChild(method)); }
/** * Returns a {@link Statement}: apply all static fields assignable to {@link TestRule} annotated with * {@link ClassRule}. * * @param statement the base statement * @return a RunRules statement if any class-level {@link Rule}s are found, or the base statement */ protected Statement withClassRules(Statement statement) { List<TestRule> classRules = classRules(); return classRules.isEmpty() ? statement : new RunRules(statement, classRules, getDescription()); }
protected Statement withRules(final Interaction interaction, final Object target, final Statement statement) { final List<TestRule> testRules = testClass.getAnnotatedMethodValues(target, Rule.class, TestRule.class); testRules.addAll(testClass.getAnnotatedFieldValues(target, Rule.class, TestRule.class)); return testRules.isEmpty() ? statement : new RunRules(statement, testRules, describeChild(interaction)); } }
/** * Overriding methodInvoker in order to place LightAir's test rules as the * leading ones. */ @Override protected Statement methodInvoker(FrameworkMethod method, Object test) { Statement statement = super.methodInvoker(method, test); return new RunRules(statement, Factory.getInstance().getAllTestRules(method), describeChild(method)); } }