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/rules/ExternalResource.java
package org.junit.rules;
import java.util.ArrayList;
import java.util.List;
import org.junit.runner.Description;
import org.junit.runners.model.MultipleFailureException;
import org.junit.runners.model.Statement;
/**
* A base class for Rules (like TemporaryFolder) that set up an external
* resource before a test (a file, socket, server, database connection, etc.),
* and guarantee to tear it down afterward:
*
* <pre>
* public static class UsesExternalResource {
* Server myServer= new Server();
*
* @Rule
* public ExternalResource resource= new ExternalResource() {
* @Override
* protected void before() throws Throwable {
* myServer.connect();
* };
*
* @Override
* protected void after() {
* myServer.disconnect();
* };
* };
*
* @Test
* public void testFoo() {
* new Client().run(myServer);
* }
* }
* </pre>
*
* @since 4.7
*/
public abstract class ExternalResource implements TestRule {
public Statement apply(Statement base, Description description) {
return statement(base);
}
private Statement statement(final Statement base) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
before();
List<Throwable> errors = new ArrayList<Throwable>();
try {
base.evaluate();
} catch (Throwable t) {
errors.add(t);
} finally {
try {
after();
} catch (Throwable t) {
errors.add(t);
}
}
MultipleFailureException.assertEmpty(errors);
}
};
}
/**
* Override to set up your specific external resource.
*
* @throws Throwable if setup fails (which will disable {@code after}
*/
protected void before() throws Throwable {
// do nothing
}
/**
* Override to tear down your specific external resource.
*/
protected void after() {
// do nothing
}
}
⏎ org/junit/rules/ExternalResource.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, ≈71🔥, 0💬
Popular Posts:
commons-fileupload-1.3.3 -sources.jaris the source JAR file for Apache Commons FileUpload 1.3., whic...
JDK 17 jdk.internal.vm.ci.jmod is the JMOD file for JDK 17 Internal VM CI module. JDK 17 Internal VM...
How to download and install Apache XMLBeans-2.6.0.zip? If you want to try the XMLBeans Java library,...
How to download and install ojdbc14.jar for Oracle 10g R2? ojdbc14.jar for Oracle 10g R2 is a Java 1...
commons-net.jar is the bytecode of Apache Commons Net library, which implements the client side of m...