aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/junit/runner/Request.java
diff options
context:
space:
mode:
authorDavid Srbecky <dsrbecky@google.com>2021-02-24 15:52:50 +0000
committerDavid Srbecky <dsrbecky@google.com>2021-02-24 15:52:50 +0000
commit08a6d4b74555db6d01048fc7065eb1e2bfaf33bc (patch)
tree81124de095a6b4a53b223d0f70cadde9744ee44a /src/main/java/org/junit/runner/Request.java
parent6a658e7a4df0cc8ea6465da46fcf1a823cb0d491 (diff)
downloadjunit-08a6d4b74555db6d01048fc7065eb1e2bfaf33bc.tar.gz
Revert "Upgrade external/junit to 4.13.2"
Revert submission 1601635 Reason for revert: b/181123058 Reverted Changes: I8f5cd1266:Remove support for stuck threads Ifdb59336d:Remove DisableOnDebug (new in 4.12) as it is not s... I6abae5aed:Extra generic type information to aid certain java... I5ec909df6:Upgrade external/junit to 4.13.2 Change-Id: Idaddfc2039816a8d7b12c91fdd540b801ab854ff
Diffstat (limited to 'src/main/java/org/junit/runner/Request.java')
-rw-r--r--src/main/java/org/junit/runner/Request.java58
1 files changed, 13 insertions, 45 deletions
diff --git a/src/main/java/org/junit/runner/Request.java b/src/main/java/org/junit/runner/Request.java
index 7b9a990..79c0f1e 100644
--- a/src/main/java/org/junit/runner/Request.java
+++ b/src/main/java/org/junit/runner/Request.java
@@ -5,11 +5,9 @@ import java.util.Comparator;
import org.junit.internal.builders.AllDefaultPossibilitiesBuilder;
import org.junit.internal.requests.ClassRequest;
import org.junit.internal.requests.FilterRequest;
-import org.junit.internal.requests.OrderingRequest;
import org.junit.internal.requests.SortingRequest;
import org.junit.internal.runners.ErrorReportingRunner;
import org.junit.runner.manipulation.Filter;
-import org.junit.runner.manipulation.Ordering;
import org.junit.runners.model.InitializationError;
/**
@@ -73,11 +71,12 @@ public abstract class Request {
*/
public static Request classes(Computer computer, Class<?>... classes) {
try {
- AllDefaultPossibilitiesBuilder builder = new AllDefaultPossibilitiesBuilder();
+ AllDefaultPossibilitiesBuilder builder = new AllDefaultPossibilitiesBuilder(true);
Runner suite = computer.getSuite(builder, classes);
return runner(suite);
} catch (InitializationError e) {
- return runner(new ErrorReportingRunner(e, classes));
+ throw new RuntimeException(
+ "Bug in saff's brain: Suite constructor, called as above, should always complete");
}
}
@@ -133,16 +132,13 @@ public abstract class Request {
}
/**
- * Returns a Request that only runs tests whose {@link Description}
- * matches the given description.
+ * Returns a Request that only runs contains tests whose {@link Description}
+ * equals <code>desiredDescription</code>
*
- * <p>Returns an empty {@code Request} if {@code desiredDescription} is not a single test and filters all but the single
- * test if {@code desiredDescription} is a single test.</p>
- *
- * @param desiredDescription {@code Description} of those tests that should be run
+ * @param desiredDescription {@link Description} of those tests that should be run
* @return the filtered Request
*/
- public Request filterWith(Description desiredDescription) {
+ public Request filterWith(final Description desiredDescription) {
return filterWith(Filter.matchMethodDescription(desiredDescription));
}
@@ -153,15 +149,15 @@ public abstract class Request {
* For example, here is code to run a test suite in alphabetical order:
* <pre>
* private static Comparator&lt;Description&gt; forward() {
- * return new Comparator&lt;Description&gt;() {
- * public int compare(Description o1, Description o2) {
- * return o1.getDisplayName().compareTo(o2.getDisplayName());
- * }
- * };
+ * return new Comparator&lt;Description&gt;() {
+ * public int compare(Description o1, Description o2) {
+ * return o1.getDisplayName().compareTo(o2.getDisplayName());
+ * }
+ * };
* }
*
* public static main() {
- * new JUnitCore().run(Request.aClass(AllTests.class).sortWith(forward()));
+ * new JUnitCore().run(Request.aClass(AllTests.class).sortWith(forward()));
* }
* </pre>
*
@@ -171,32 +167,4 @@ public abstract class Request {
public Request sortWith(Comparator<Description> comparator) {
return new SortingRequest(this, comparator);
}
-
- /**
- * Returns a Request whose Tests can be run in a certain order, defined by
- * <code>ordering</code>
- * <p>
- * For example, here is code to run a test suite in reverse order:
- * <pre>
- * private static Ordering reverse() {
- * return new Ordering() {
- * public List&lt;Description&gt; orderItems(Collection&lt;Description&gt; descriptions) {
- * List&lt;Description&gt; ordered = new ArrayList&lt;&gt;(descriptions);
- * Collections.reverse(ordered);
- * return ordered;
- * }
- * }
- * }
- *
- * public static main() {
- * new JUnitCore().run(Request.aClass(AllTests.class).orderWith(reverse()));
- * }
- * </pre>
- *
- * @return a Request with ordered Tests
- * @since 4.13
- */
- public Request orderWith(Ordering ordering) {
- return new OrderingRequest(this, ordering);
- }
}