Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JUnit 4.13.2 Source Code Files
JUnit Source Code Files are provided in the source package file, junit-4.13.2-sources.jar.
You can browse JUnit Source Code files below:
✍: FYIcenter.com
⏎ org/junit/rules/RuleChain.java
package org.junit.rules; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.junit.Rule; import org.junit.runner.Description; import org.junit.runners.model.Statement; /** * The {@code RuleChain} can be used for creating composite rules. You create a * {@code RuleChain} with {@link #outerRule(TestRule)} and subsequent calls of * {@link #around(TestRule)}: * * <pre> * public abstract class CompositeRules { * public static TestRule extendedLogging() { * return RuleChain.outerRule(new LoggingRule("outer rule")) * .around(new LoggingRule("middle rule")) * .around(new LoggingRule("inner rule")); * } * } * </pre> * * <pre> * public class UseRuleChain { * @Rule * public final TestRule extendedLogging = CompositeRules.extendedLogging(); * * @Test * public void example() { * assertTrue(true); * } * } * </pre> * * writes the log * * <pre> * starting outer rule * starting middle rule * starting inner rule * finished inner rule * finished middle rule * finished outer rule * </pre> * * In older versions of JUnit (before 4.13) {@code RuleChain} was used for * ordering rules. We recommend to not use it for this purpose anymore. You can * use the attribute {@code order} of the annotation {@link Rule#order() Rule} * or {@link org.junit.ClassRule#order() ClassRule} for ordering rules. * * @see org.junit.Rule#order() * @see org.junit.ClassRule#order() * @since 4.10 */ public class RuleChain implements TestRule { private static final RuleChain EMPTY_CHAIN = new RuleChain( Collections.<TestRule>emptyList()); private List<TestRule> rulesStartingWithInnerMost; /** * Returns a {@code RuleChain} without a {@link TestRule}. This method may * be the starting point of a {@code RuleChain}. * * @return a {@code RuleChain} without a {@link TestRule}. */ public static RuleChain emptyRuleChain() { return EMPTY_CHAIN; } /** * 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 RuleChain(List<TestRule> rules) { this.rulesStartingWithInnerMost = rules; } /** * Create a new {@code RuleChain}, which encloses the given {@link TestRule} with * the rules of the current {@code RuleChain}. * * @param enclosedRule the rule to enclose; must not be {@code null}. * @return a new {@code RuleChain}. * @throws NullPointerException if the argument {@code enclosedRule} is {@code null} */ public RuleChain around(TestRule enclosedRule) { if (enclosedRule == null) { throw new NullPointerException("The enclosed rule must not be null"); } List<TestRule> rulesOfNewChain = new ArrayList<TestRule>(); rulesOfNewChain.add(enclosedRule); rulesOfNewChain.addAll(rulesStartingWithInnerMost); return new RuleChain(rulesOfNewChain); } /** * {@inheritDoc} */ public Statement apply(Statement base, Description description) { return new RunRules(base, rulesStartingWithInnerMost, description); } }
⏎ org/junit/rules/RuleChain.java
Or download all of them as a single archive file:
File name: junit-4.13.2-sources.jar File size: 234540 bytes Release date: 2021-02-13 Download
⇒ Download and Install junit-4.12.jar
⇐ Download and Install junit-4.13.2.jar
2016-03-28, 11582👍, 0💬
Popular Posts:
JDK 11 jdk.javadoc.jmod is the JMOD file for JDK 11 Java Document tool, which can be invoked by the ...
ANTLR is a powerful parser generator for multiple programming languages including Java. ANTLR contai...
What Is javamail-1_2.zip? javamail-1_2.zip is the binary package of JavaMail API 1.2 in ZIP format. ...
Old version of xml-apis.jar. JAR File Size and Download Location: File name: xmlParserAPIs.jar File ...
SLF4J API is a simple API that allows to plug in any desired logging library at deployment time. Her...