Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
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 (322)
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/runners/JUnit4ClassRunner.java
package org.junit.internal.runners;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import org.junit.runner.Description;
import org.junit.runner.Runner;
import org.junit.runner.manipulation.Filter;
import org.junit.runner.manipulation.Filterable;
import org.junit.runner.manipulation.NoTestsRemainException;
import org.junit.runner.manipulation.Sortable;
import org.junit.runner.manipulation.Sorter;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
/**
* @deprecated Included for backwards compatibility with JUnit 4.4. Will be
* removed in the next major release. Please use
* {@link BlockJUnit4ClassRunner} in place of {@link JUnit4ClassRunner}.
*/
@Deprecated
public class JUnit4ClassRunner extends Runner implements Filterable, Sortable {
private final List<Method> testMethods;
private TestClass testClass;
public JUnit4ClassRunner(Class<?> klass) throws InitializationError {
testClass = new TestClass(klass);
testMethods = getTestMethods();
validate();
}
protected List<Method> getTestMethods() {
return testClass.getTestMethods();
}
protected void validate() throws InitializationError {
MethodValidator methodValidator = new MethodValidator(testClass);
methodValidator.validateMethodsForDefaultRunner();
methodValidator.assertValid();
}
@Override
public void run(final RunNotifier notifier) {
new ClassRoadie(notifier, testClass, getDescription(), new Runnable() {
public void run() {
runMethods(notifier);
}
}).runProtected();
}
protected void runMethods(final RunNotifier notifier) {
for (Method method : testMethods) {
invokeTestMethod(method, notifier);
}
}
@Override
public Description getDescription() {
Description spec = Description.createSuiteDescription(getName(), classAnnotations());
List<Method> testMethods = this.testMethods;
for (Method method : testMethods) {
spec.addChild(methodDescription(method));
}
return spec;
}
protected Annotation[] classAnnotations() {
return testClass.getJavaClass().getAnnotations();
}
protected String getName() {
return getTestClass().getName();
}
protected Object createTest() throws Exception {
return getTestClass().getConstructor().newInstance();
}
protected void invokeTestMethod(Method method, RunNotifier notifier) {
Description description = methodDescription(method);
Object test;
try {
test = createTest();
} catch (InvocationTargetException e) {
testAborted(notifier, description, e.getCause());
return;
} catch (Exception e) {
testAborted(notifier, description, e);
return;
}
TestMethod testMethod = wrapMethod(method);
new MethodRoadie(test, testMethod, notifier, description).run();
}
private void testAborted(RunNotifier notifier, Description description,
Throwable e) {
notifier.fireTestStarted(description);
notifier.fireTestFailure(new Failure(description, e));
notifier.fireTestFinished(description);
}
protected TestMethod wrapMethod(Method method) {
return new TestMethod(method, testClass);
}
protected String testName(Method method) {
return method.getName();
}
protected Description methodDescription(Method method) {
return Description.createTestDescription(getTestClass().getJavaClass(), testName(method), testAnnotations(method));
}
protected Annotation[] testAnnotations(Method method) {
return method.getAnnotations();
}
public void filter(Filter filter) throws NoTestsRemainException {
for (Iterator<Method> iter = testMethods.iterator(); iter.hasNext(); ) {
Method method = iter.next();
if (!filter.shouldRun(methodDescription(method))) {
iter.remove();
}
}
if (testMethods.isEmpty()) {
throw new NoTestsRemainException();
}
}
public void sort(final Sorter sorter) {
Collections.sort(testMethods, new Comparator<Method>() {
public int compare(Method o1, Method o2) {
return sorter.compare(methodDescription(o1), methodDescription(o2));
}
});
}
protected TestClass getTestClass() {
return testClass;
}
}⏎ org/junit/internal/runners/JUnit4ClassRunner.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, ≈76🔥, 0💬
Popular Posts:
What Is activation.jar? I heard it's related to JAF (JavaBeans Activation Framework) 1.0.2? The if y...
Apache ZooKeeper is an open-source server which enables highly reliable distributed coordination. Ap...
What is the dom\GetElementsByTagName .javaprovided in the Apache Xerces package? I have Apache Xerce...
JDK 11 jdk.rmic.jmod is the JMOD file for JDK 11 RMI (Remote Method Invocation) Compiler Tool tool, ...
jTDS JDBC Driver Source Code Files are provided in the source package file, jtds-1.3.1-fyi.zip. You ...