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/runner/JUnitCommandLineParseResult.java
package org.junit.runner;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.junit.internal.Classes;
import org.junit.runner.FilterFactory.FilterNotCreatedException;
import org.junit.runner.manipulation.Filter;
import org.junit.runners.model.InitializationError;
class JUnitCommandLineParseResult {
private final List<String> filterSpecs = new ArrayList<String>();
private final List<Class<?>> classes = new ArrayList<Class<?>>();
private final List<Throwable> parserErrors = new ArrayList<Throwable>();
/**
* Do not use. Testing purposes only.
*/
JUnitCommandLineParseResult() {}
/**
* Returns filter specs parsed from command line.
*/
public List<String> getFilterSpecs() {
return Collections.unmodifiableList(filterSpecs);
}
/**
* Returns test classes parsed from command line.
*/
public List<Class<?>> getClasses() {
return Collections.unmodifiableList(classes);
}
/**
* Parses the arguments.
*
* @param args Arguments
*/
public static JUnitCommandLineParseResult parse(String[] args) {
JUnitCommandLineParseResult result = new JUnitCommandLineParseResult();
result.parseArgs(args);
return result;
}
private void parseArgs(String[] args) {
parseParameters(parseOptions(args));
}
String[] parseOptions(String... args) {
for (int i = 0; i != args.length; ++i) {
String arg = args[i];
if (arg.equals("--")) {
return copyArray(args, i + 1, args.length);
} else if (arg.startsWith("--")) {
if (arg.startsWith("--filter=") || arg.equals("--filter")) {
String filterSpec;
if (arg.equals("--filter")) {
++i;
if (i < args.length) {
filterSpec = args[i];
} else {
parserErrors.add(new CommandLineParserError(arg + " value not specified"));
break;
}
} else {
filterSpec = arg.substring(arg.indexOf('=') + 1);
}
filterSpecs.add(filterSpec);
} else {
parserErrors.add(new CommandLineParserError("JUnit knows nothing about the " + arg + " option"));
}
} else {
return copyArray(args, i, args.length);
}
}
return new String[]{};
}
private String[] copyArray(String[] args, int from, int to) {
String[] result = new String[to - from];
for (int j = from; j != to; ++j) {
result[j - from] = args[j];
}
return result;
}
void parseParameters(String[] args) {
for (String arg : args) {
try {
classes.add(Classes.getClass(arg));
} catch (ClassNotFoundException e) {
parserErrors.add(new IllegalArgumentException("Could not find class [" + arg + "]", e));
}
}
}
private Request errorReport(Throwable cause) {
return Request.errorReport(JUnitCommandLineParseResult.class, cause);
}
/**
* Creates a {@link Request}.
*
* @param computer {@link Computer} to be used.
*/
public Request createRequest(Computer computer) {
if (parserErrors.isEmpty()) {
Request request = Request.classes(
computer, classes.toArray(new Class<?>[classes.size()]));
return applyFilterSpecs(request);
} else {
return errorReport(new InitializationError(parserErrors));
}
}
private Request applyFilterSpecs(Request request) {
try {
for (String filterSpec : filterSpecs) {
Filter filter = FilterFactories.createFilterFromFilterSpec(
request, filterSpec);
request = request.filterWith(filter);
}
return request;
} catch (FilterNotCreatedException e) {
return errorReport(e);
}
}
/**
* Exception used if there's a problem parsing the command line.
*/
public static class CommandLineParserError extends Exception {
private static final long serialVersionUID= 1L;
public CommandLineParserError(String message) {
super(message);
}
}
}
⏎ org/junit/runner/JUnitCommandLineParseResult.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, ≈84🔥, 0💬
Popular Posts:
JDK 11 java.sql.rowset.jmod is the JMOD file for JDK 11 SQL Rowset module. JDK 11 SQL Rowset module ...
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...
JRE 5 sunjce_provider.jar is the JAR file for JRE 5 Sun JCE Provider, which provides implementations...
What JAR files are required to run sax\Writer.java provided in the Apache Xerces package? 1 JAR file...
maven-model-builder-3.8. 6.jaris the JAR file for Apache Maven 3.8.6 Model Builder module. Apache Ma...