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/internal/builders/AnnotatedBuilder.java
package org.junit.internal.builders; import org.junit.runner.RunWith; import org.junit.runner.Runner; import org.junit.runners.model.InitializationError; import org.junit.runners.model.RunnerBuilder; import java.lang.reflect.Modifier; /** * The {@code AnnotatedBuilder} is a strategy for constructing runners for test class that have been annotated with the * {@code @RunWith} annotation. All tests within this class will be executed using the runner that was specified within * the annotation. * <p> * If a runner supports inner member classes, the member classes will inherit the runner from the enclosing class, e.g.: * <pre> * @RunWith(MyRunner.class) * public class MyTest { * // some tests might go here * * public class MyMemberClass { * @Test * public void thisTestRunsWith_MyRunner() { * // some test logic * } * * // some more tests might go here * } * * @RunWith(AnotherRunner.class) * public class AnotherMemberClass { * // some tests might go here * * public class DeepInnerClass { * @Test * public void thisTestRunsWith_AnotherRunner() { * // some test logic * } * } * * public class DeepInheritedClass extends SuperTest { * @Test * public void thisTestRunsWith_SuperRunner() { * // some test logic * } * } * } * } * * @RunWith(SuperRunner.class) * public class SuperTest { * // some tests might go here * } * </pre> * The key points to note here are: * <ul> * <li>If there is no RunWith annotation, no runner will be created.</li> * <li>The resolve step is inside-out, e.g. the closest RunWith annotation wins</li> * <li>RunWith annotations are inherited and work as if the class was annotated itself.</li> * <li>The default JUnit runner does not support inner member classes, * so this is only valid for custom runners that support inner member classes.</li> * <li>Custom runners with support for inner classes may or may not support RunWith annotations for member * classes. Please refer to the custom runner documentation.</li> * </ul> * * @see org.junit.runners.model.RunnerBuilder * @see org.junit.runner.RunWith * @since 4.0 */ public class AnnotatedBuilder extends RunnerBuilder { private static final String CONSTRUCTOR_ERROR_FORMAT = "Custom runner class %s should have a public constructor with signature %s(Class testClass)"; private final RunnerBuilder suiteBuilder; public AnnotatedBuilder(RunnerBuilder suiteBuilder) { this.suiteBuilder = suiteBuilder; } @Override public Runner runnerForClass(Class<?> testClass) throws Exception { for (Class<?> currentTestClass = testClass; currentTestClass != null; currentTestClass = getEnclosingClassForNonStaticMemberClass(currentTestClass)) { RunWith annotation = currentTestClass.getAnnotation(RunWith.class); if (annotation != null) { return buildRunner(annotation.value(), testClass); } } return null; } private Class<?> getEnclosingClassForNonStaticMemberClass(Class<?> currentTestClass) { if (currentTestClass.isMemberClass() && !Modifier.isStatic(currentTestClass.getModifiers())) { return currentTestClass.getEnclosingClass(); } else { return null; } } public Runner buildRunner(Class<? extends Runner> runnerClass, Class<?> testClass) throws Exception { try { return runnerClass.getConstructor(Class.class).newInstance(testClass); } catch (NoSuchMethodException e) { try { return runnerClass.getConstructor(Class.class, RunnerBuilder.class).newInstance(testClass, suiteBuilder); } catch (NoSuchMethodException e2) { String simpleName = runnerClass.getSimpleName(); throw new InitializationError(String.format( CONSTRUCTOR_ERROR_FORMAT, simpleName, simpleName)); } } } }
⏎ org/junit/internal/builders/AnnotatedBuilder.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, 13687👍, 0💬
Popular Posts:
What Is poi-3.5.jar - Part 2? poi-3.5.jar is one of the JAR files for Apache POI 3.5, which provides...
JAX-WS is an API for building web services and clients. It is the next generation Web Services API r...
JasperReports, the world's most popular open source business intelligence and reporting engine and J...
What Is javamail1_1_3.zip? javamail1_1_3.zip is the binary package of JavaMail API 1.1.3 in ZIP form...
What Is jtds-1.2.2.jar? jtds-1.2.2.jar is the JAR files of jTDS Java library 1.2.2, which is a JDBC ...