/** * @param target the test case instance * @return a list of MethodRules that should be applied when executing this * test */ protected List<org.junit.rules.MethodRule> rules(Object target) { return getTestClass().getAnnotatedFieldValues(target, Rule.class, org.junit.rules.MethodRule.class); }
/** * @return the {@code ClassRule}s that can transform the block that runs * each method in the tested class. */ protected List<TestRule> classRules() { List<TestRule> result = fTestClass.getAnnotatedMethodValues(null, ClassRule.class, TestRule.class); result.addAll(fTestClass.getAnnotatedFieldValues(null, ClassRule.class, TestRule.class)); return result; }
/** * @param target the test case instance * @return a list of TestRules that should be applied when executing this * test */ protected List<TestRule> getTestRules(Object target) { List<TestRule> result = getTestClass().getAnnotatedMethodValues(target, Rule.class, TestRule.class); result.addAll(getTestClass().getAnnotatedFieldValues(target, Rule.class, TestRule.class)); return result; }
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)); }
/** * @param target the test case instance * @return a list of MethodRules that should be applied when executing this * test */ protected List<org.junit.rules.MethodRule> rules(Object target) { return getTestClass().getAnnotatedFieldValues(target, Rule.class, org.junit.rules.MethodRule.class); }
/** * @return the {@code ClassRule}s that can transform the block that runs * each method in the tested class. */ protected List<TestRule> classRules() { List<TestRule> result = fTestClass.getAnnotatedMethodValues(null, ClassRule.class, TestRule.class); result.addAll(fTestClass.getAnnotatedFieldValues(null, ClassRule.class, TestRule.class)); return result; }
private Statement withRules(FrameworkMethod method, Object target, Statement statement) { Statement result = statement; for (MethodRule each : getTestClass().getAnnotatedFieldValues(target, Rule.class, MethodRule.class)) { result = each.apply(result, method, target); } return result; }
/** * @param target the test case instance * @return a list of TestRules that should be applied when executing this * test */ protected List<TestRule> getTestRules(Object target) { List<TestRule> result = getTestClass().getAnnotatedMethodValues(target, Rule.class, TestRule.class); result.addAll(getTestClass().getAnnotatedFieldValues(target, Rule.class, TestRule.class)); return result; }
/** * @param target the test case instance * @return a list of MethodRules that should be applied when executing this * test */ protected List<org.junit.rules.MethodRule> rules(Object target) { return getTestClass().getAnnotatedFieldValues(target, Rule.class, org.junit.rules.MethodRule.class); }
/** * @param target the test case instance * @return a list of MethodRules that should be applied when executing this * test */ protected List<org.junit.rules.MethodRule> rules(Object target) { return getTestClass().getAnnotatedFieldValues(target, Rule.class, org.junit.rules.MethodRule.class); }
/** * @param testClass * @return the {@code ClassRule}s that can transform the block that runs * each method in the tested class. * * @see ParentRunner#classRules() */ public static List<TestRule> getClassRules(TestClass testClass) { List<TestRule> result = testClass.getAnnotatedMethodValues(null, ClassRule.class, TestRule.class); result.addAll(testClass.getAnnotatedFieldValues(null, ClassRule.class, TestRule.class)); return result; }
/** * Simply copied from BlockJUnit4ClassRunner, since its not accessible. */ private Statement withRules(FrameworkMethod method, Object target, Statement statement) { Statement result = statement; for (MethodRule each : getTestClass().getAnnotatedFieldValues(target, Rule.class, MethodRule.class)) result = each.apply(result, method, target); return result; }
/** * Simply copied from BlockJUnit4ClassRunner, since its not accessible. */ private Statement withRules(FrameworkMethod method, Object target, Statement statement) { Statement result = statement; for (MethodRule each : getTestClass().getAnnotatedFieldValues(target, Rule.class, MethodRule.class)) result = each.apply(result, method, target); return result; }
/** * @param target the test case instance * @return a list of TestRules that should be applied when executing this * test */ protected List<TestRule> getTestRules(Object target) { List<TestRule> result = getTestClass().getAnnotatedMethodValues(target, Rule.class, TestRule.class); result.addAll(getTestClass().getAnnotatedFieldValues(target, Rule.class, TestRule.class)); return result; }
/** * @param target the test case instance * @return a list of MethodRules that should be applied when executing this test */ protected List<MethodRule> rules(Object target) { List<MethodRule> rules = getTestClass().getAnnotatedMethodValues(target, Rule.class, MethodRule.class); rules.addAll(getTestClass().getAnnotatedFieldValues(target, Rule.class, MethodRule.class)); return rules; }
/** * @param target the test case instance * @return a list of MethodRules that should be applied when executing this * test */ protected List<MethodRule> rules(Object target) { List<MethodRule> rules = getTestClass().getAnnotatedMethodValues(target, Rule.class, MethodRule.class); rules.addAll(getTestClass().getAnnotatedFieldValues(target, Rule.class, MethodRule.class)); return rules; }
/** * @return the {@code ClassRule}s that can transform the block that runs * each method in the tested class. */ protected List<TestRule> classRules() { List<TestRule> result = getTestClass().getAnnotatedMethodValues(null, ClassRule.class, TestRule.class); result.addAll(getTestClass().getAnnotatedFieldValues(null, ClassRule.class, TestRule.class)); return result; }
/** * @param target the test case instance * @return a list of TestRules that should be applied when executing this * test */ protected List<TestRule> getTestRules(Object target) { List<TestRule> result = getTestClass().getAnnotatedMethodValues(target, Rule.class, TestRule.class); result.addAll(getTestClass().getAnnotatedFieldValues(target, Rule.class, TestRule.class)); return result; }
@Override protected List<TestRule> getTestRules(Object target) { List<TestRule> result = getTestClass().getAnnotatedMethodValues(target, Rule.class, TestRule.class); result.addAll(getTestClass().getAnnotatedFieldValues(target, Rule.class, TestRule.class)); return result; }
public RulesFactory<A, R> withRules(TestClass aType, Object aTest) { for (R each : aType.getAnnotatedFieldValues(aTest, annotationType, ruleType)) { withRule(each); } for (FrameworkMethod each : aType.getAnnotatedMethods(annotationType)) { if (ruleType.isAssignableFrom(each.getMethod().getReturnType())) { withRule(onMethod(ruleType, each, aTest)); } } return this; }