/** * Returns a {@code RuleChain} with a single {@link TestRule}. This method * is the usual starting point of a {@code RuleChain}. * * @param outerRule the outer rule of the {@code RuleChain}. * @return a {@code RuleChain} with a single {@link TestRule}. */ public static RuleChain outerRule(TestRule outerRule) { return emptyRuleChain().around(outerRule); }
/** * Returns a {@code RuleChain} with a single {@link TestRule}. This method * is the usual starting point of a {@code RuleChain}. * * @param outerRule the outer rule of the {@code RuleChain}. * @return a {@code RuleChain} with a single {@link TestRule}. */ public static RuleChain outerRule(TestRule outerRule) { return emptyRuleChain().around(outerRule); }
/** * Creates a {@link RuleChain} where the rules are evaluated in the order you pass in. * * @param testRules * test rules to evaluate * @return a new rule chain. */ public static RuleChain create(final TestRule... testRules) { if (testRules == null || testRules.length == 0) { return RuleChain.emptyRuleChain(); } RuleChain ruleChain = RuleChain.outerRule(testRules[0]); for (int i = 1; i < testRules.length; i++) { ruleChain = ruleChain.around(testRules[i]); } return ruleChain; } }
protected AbstractJdbcAppenderFactoryMethodTest(final JdbcRule jdbcRule, final String databaseType) { this.rules = RuleChain.emptyRuleChain().around(jdbcRule).around(new LoggerContextRule( "org/apache/logging/log4j/core/appender/db/jdbc/log4j2-" + databaseType + "-factory-method.xml")); this.jdbcRule = jdbcRule; }
protected AbstractJdbcAppenderDataSourceTest(final JdbcRule jdbcRule) { this.rules = RuleChain.emptyRuleChain() .around(new JndiRule("java:/comp/env/jdbc/TestDataSourceAppender", createMockDataSource())) .around(jdbcRule) .around(new LoggerContextRule( "org/apache/logging/log4j/core/appender/db/jdbc/log4j2-data-source.xml")); this.jdbcRule = jdbcRule; }
protected JdbcAppenderMapMessageDataSourceTest(final JdbcRule jdbcRule) { // @formatter:off this.rules = RuleChain.emptyRuleChain() .around(new JndiRule("java:/comp/env/jdbc/TestDataSourceAppender", createMockDataSource())) .around(jdbcRule) .around(new LoggerContextRule("org/apache/logging/log4j/core/appender/db/jdbc/log4j2-data-source-map-message.xml")); // @formatter:on this.jdbcRule = jdbcRule; }
/** * Returns a {@code RuleChain} with a single {@link TestRule}. This method * is the usual starting point of a {@code RuleChain}. * * @param outerRule the outer rule of the {@code RuleChain}. * @return a {@code RuleChain} with a single {@link TestRule}. */ public static RuleChain outerRule(TestRule outerRule) { return emptyRuleChain().around(outerRule); }
/** * Returns a {@code RuleChain} with a single {@link TestRule}. This method * is the usual starting point of a {@code RuleChain}. * * @param outerRule the outer rule of the {@code RuleChain}. * @return a {@code RuleChain} with a single {@link TestRule}. */ public static RuleChain outerRule(TestRule outerRule) { return emptyRuleChain().around(outerRule); }
@Nonnull public static RuleChain toRuleChain(@Nonnull Iterable<TestRule> rules) { Preconditions.checkNotNull(rules, "rules"); RuleChain ruleChain = RuleChain.emptyRuleChain(); for (TestRule rule : rules) { ruleChain.around(rule); } return ruleChain; } }
/** * Returns a {@code RuleChain} with a single {@link TestRule}. This method * is the usual starting point of a {@code RuleChain}. * * @param outerRule the outer rule of the {@code RuleChain}. * @return a {@code RuleChain} with a single {@link TestRule}. */ public static RuleChain outerRule(TestRule outerRule) { return emptyRuleChain().around(outerRule); }
/** * Returns a {@code RuleChain} with a single {@link TestRule}. This method * is the usual starting point of a {@code RuleChain}. * * @param outerRule the outer rule of the {@code RuleChain}. * @return a {@code RuleChain} with a single {@link TestRule}. */ public static RuleChain outerRule(TestRule outerRule) { return emptyRuleChain().around(outerRule); }
/** * Returns a {@code RuleChain} with a single {@link TestRule}. This method * is the usual starting point of a {@code RuleChain}. * * @param outerRule the outer rule of the {@code RuleChain}. * @return a {@code RuleChain} with a single {@link TestRule}. */ public static RuleChain outerRule(TestRule outerRule) { return emptyRuleChain().around(outerRule); }
private AggregateGuiceModuleTestRule(List<GuiceModuleTestRule> subrule) { this.subrule = subrule; this.chain = subrule .stream() .reduce(RuleChain.emptyRuleChain(), RuleChain::around, RuleChain::around); }
public StatelessTestRunner(Class<?> testedProductClass) throws InitializationError { super(testedProductClass); this.productRef = new LazyReference<TestedProduct<?>>() { @Override protected TestedProduct<?> create() throws Exception { return createProduct(); } }; try { setupInjector(); prepareFixtures(); injectClassRules(); baseMethodRules = RuleChain.emptyRuleChain(); baseClassRules = RuleChain.emptyRuleChain(); } catch(Exception e) { throw new InitializationError(e); } }
public MockitoContainer(Object test) { mockComponentContainer = new MockComponentContainer(test); innerChain = RuleChain.emptyRuleChain() .around(new InitMockitoMocks(test)) .around(mockComponentContainer); }