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
⏎ junit/framework/TestResult.java
package junit.framework;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
/**
* A <code>TestResult</code> collects the results of executing
* a test case. It is an instance of the Collecting Parameter pattern.
* The test framework distinguishes between <i>failures</i> and <i>errors</i>.
* A failure is anticipated and checked for with assertions. Errors are
* unanticipated problems like an {@link ArrayIndexOutOfBoundsException}.
*
* @see Test
*/
public class TestResult {
protected List<TestFailure> fFailures;
protected List<TestFailure> fErrors;
protected List<TestListener> fListeners;
protected int fRunTests;
private boolean fStop;
public TestResult() {
fFailures = new ArrayList<TestFailure>();
fErrors = new ArrayList<TestFailure>();
fListeners = new ArrayList<TestListener>();
fRunTests = 0;
fStop = false;
}
/**
* Adds an error to the list of errors. The passed in exception
* caused the error.
*/
public synchronized void addError(Test test, Throwable e) {
fErrors.add(new TestFailure(test, e));
for (TestListener each : cloneListeners()) {
each.addError(test, e);
}
}
/**
* Adds a failure to the list of failures. The passed in exception
* caused the failure.
*/
public synchronized void addFailure(Test test, AssertionFailedError e) {
fFailures.add(new TestFailure(test, e));
for (TestListener each : cloneListeners()) {
each.addFailure(test, e);
}
}
/**
* Registers a TestListener.
*/
public synchronized void addListener(TestListener listener) {
fListeners.add(listener);
}
/**
* Unregisters a TestListener.
*/
public synchronized void removeListener(TestListener listener) {
fListeners.remove(listener);
}
/**
* Returns a copy of the listeners.
*/
private synchronized List<TestListener> cloneListeners() {
List<TestListener> result = new ArrayList<TestListener>();
result.addAll(fListeners);
return result;
}
/**
* Informs the result that a test was completed.
*/
public void endTest(Test test) {
for (TestListener each : cloneListeners()) {
each.endTest(test);
}
}
/**
* Gets the number of detected errors.
*/
public synchronized int errorCount() {
return fErrors.size();
}
/**
* Returns an Enumeration for the errors.
*/
public synchronized Enumeration<TestFailure> errors() {
return Collections.enumeration(fErrors);
}
/**
* Gets the number of detected failures.
*/
public synchronized int failureCount() {
return fFailures.size();
}
/**
* Returns an Enumeration for the failures.
*/
public synchronized Enumeration<TestFailure> failures() {
return Collections.enumeration(fFailures);
}
/**
* Runs a TestCase.
*/
protected void run(final TestCase test) {
startTest(test);
Protectable p = new Protectable() {
public void protect() throws Throwable {
test.runBare();
}
};
runProtected(test, p);
endTest(test);
}
/**
* Gets the number of run tests.
*/
public synchronized int runCount() {
return fRunTests;
}
/**
* Runs a TestCase.
*/
public void runProtected(final Test test, Protectable p) {
try {
p.protect();
} catch (AssertionFailedError e) {
addFailure(test, e);
} catch (ThreadDeath e) { // don't catch ThreadDeath by accident
throw e;
} catch (Throwable e) {
addError(test, e);
}
}
/**
* Checks whether the test run should stop.
*/
public synchronized boolean shouldStop() {
return fStop;
}
/**
* Informs the result that a test will be started.
*/
public void startTest(Test test) {
final int count = test.countTestCases();
synchronized (this) {
fRunTests += count;
}
for (TestListener each : cloneListeners()) {
each.startTest(test);
}
}
/**
* Marks that the test run should stop.
*/
public synchronized void stop() {
fStop = true;
}
/**
* Returns whether the entire test was successful or not.
*/
public synchronized boolean wasSuccessful() {
return failureCount() == 0 && errorCount() == 0;
}
}
⏎ junit/framework/TestResult.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, ≈79🔥, 0💬
Popular Posts:
Guava is a suite of core and expanded libraries that include utility classes, google's collections, ...
JDK 11 jdk.scripting.nashorn.jm odis the JMOD file for JDK 11 Scripting Nashorn module. JDK 11 Scrip...
JDK 11 jdk.crypto.ec.jmod is the JMOD file for JDK 11 Crypto EC module. JDK 11 Crypto EC module comp...
What Is activation.jar? I heard it's related to JAF (JavaBeans Activation Framework) 1.0.2? The if y...
What Is ojdbc8.jar for Oracle 12c R2? ojdbc8.jar for Oracle 12c R2 is the JAR files of ojdbc.jar, JD...