|
1 | 1 | package org.junit.runner;
|
2 | 2 |
|
3 |
| -import java.util.Collection; |
4 | 3 | import java.util.Comparator;
|
5 | 4 |
|
6 | 5 | import org.junit.internal.builders.AllDefaultPossibilitiesBuilder;
|
7 | 6 | import org.junit.internal.requests.ClassRequest;
|
8 | 7 | import org.junit.internal.requests.FilterRequest;
|
| 8 | +import org.junit.internal.requests.OrderingRequest; |
9 | 9 | import org.junit.internal.requests.SortingRequest;
|
10 | 10 | import org.junit.internal.runners.ErrorReportingRunner;
|
11 | 11 | import org.junit.runner.manipulation.Filter;
|
12 |
| -import org.junit.runner.manipulation.InvalidOrderingException; |
13 | 12 | import org.junit.runner.manipulation.Ordering;
|
14 | 13 | import org.junit.runners.model.InitializationError;
|
15 | 14 |
|
@@ -197,19 +196,7 @@ public Request sortWith(Comparator<Description> comparator) {
|
197 | 196 | * @return a Request with ordered Tests
|
198 | 197 | * @since 4.13
|
199 | 198 | */
|
200 |
| - public Request orderWith(final Ordering ordering) { |
201 |
| - final Request delegate = this; |
202 |
| - return new Request() { |
203 |
| - @Override |
204 |
| - public Runner getRunner() { |
205 |
| - try { |
206 |
| - Runner runner = delegate.getRunner(); |
207 |
| - ordering.apply(runner); |
208 |
| - return runner; |
209 |
| - } catch (InvalidOrderingException e) { |
210 |
| - return new ErrorReportingRunner(ordering.getClass(), e); |
211 |
| - } |
212 |
| - } |
213 |
| - }; |
| 199 | + public Request orderWith(Ordering ordering) { |
| 200 | + return new OrderingRequest(this, ordering); |
214 | 201 | }
|
215 | 202 | }
|
0 commit comments