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/ClassRule.java
package org.junit; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotates static fields that reference rules or methods that return them. A field must be public, * static, and a subtype of {@link org.junit.rules.TestRule}. A method must be public static, and return * a subtype of {@link org.junit.rules.TestRule}. * <p> * The {@link org.junit.runners.model.Statement} passed * to the {@link org.junit.rules.TestRule} will run any {@link BeforeClass} methods, * then the entire body of the test class (all contained methods, if it is * a standard JUnit test class, or all contained classes, if it is a * {@link org.junit.runners.Suite}), and finally any {@link AfterClass} methods. * <p> * The statement passed to the {@link org.junit.rules.TestRule} will never throw an exception, * and throwing an exception from the {@link org.junit.rules.TestRule} will result in undefined * behavior. This means that some {@link org.junit.rules.TestRule}s, such as * {@link org.junit.rules.ErrorCollector}, * {@link org.junit.rules.ExpectedException}, * and {@link org.junit.rules.Timeout}, * have undefined behavior when used as {@link ClassRule}s. * <p> * If there are multiple * annotated {@link ClassRule}s on a class, they will be applied in an order * that depends on your JVM's implementation of the reflection API, which is * undefined, in general. However, Rules defined by fields will always be applied * after Rules defined by methods, i.e. the Statements returned by the former will * be executed around those returned by the latter. * * <h3>Usage</h3> * <p> * For example, here is a test suite that connects to a server once before * all the test classes run, and disconnects after they are finished: * <pre> * @RunWith(Suite.class) * @SuiteClasses({A.class, B.class, C.class}) * public class UsesExternalResource { * public static Server myServer= new Server(); * * @ClassRule * public static ExternalResource resource= new ExternalResource() { * @Override * protected void before() throws Throwable { * myServer.connect(); * } * * @Override * protected void after() { * myServer.disconnect(); * } * }; * } * </pre> * <p> * and the same using a method * <pre> * @RunWith(Suite.class) * @SuiteClasses({A.class, B.class, C.class}) * public class UsesExternalResource { * public static Server myServer= new Server(); * * @ClassRule * public static ExternalResource getResource() { * return new ExternalResource() { * @Override * protected void before() throws Throwable { * myServer.connect(); * } * * @Override * protected void after() { * myServer.disconnect(); * } * }; * } * } * </pre> * <p> * For more information and more examples, see {@link org.junit.rules.TestRule}. * * <h3>Ordering</h3> * <p> * You can use {@link #order()} if you want to have control over the order in * which the Rules are applied. * * <pre> * public class ThreeClassRules { * @ClassRule(order = 0) * public static LoggingRule outer = new LoggingRule("outer rule"); * * @ClassRule(order = 1) * public static LoggingRule middle = new LoggingRule("middle rule"); * * @ClassRule(order = 2) * public static LoggingRule inner = new LoggingRule("inner rule"); * * // ... * } * </pre> * * @since 4.9 */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.METHOD}) public @interface ClassRule { /** * Specifies the order in which rules are applied. The rules with a higher value are inner. * * @since 4.13 */ int order() default Rule.DEFAULT_ORDER; }
⏎ org/junit/ClassRule.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, 11129👍, 0💬
Popular Posts:
JDK 8 jconsole.jar is the JAR file for JDK 8 JConsole, which is a graphical monitoring tool to monit...
JDK 11 jdk.internal.opt.jmod is the JMOD file for JDK 11 Internal Opt module. JDK 11 Internal Opt mo...
How to merge two JAR files with "jar" commands? I am tired of specifying multiple JAR files in the c...
Java Servlet 3.0 Specification API. JAR File Size and Download Location: File name: servlet-api.jar,...
How to show the XML parsing flow with sax\DocumentTracer.java provided in the Apache Xerces package?...