aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/junit/runner/manipulation/Sorter.java
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2016-12-14 11:49:43 +0000
committerPaul Duffin <paulduffin@google.com>2016-12-20 15:52:52 +0000
commitaeb93fc33cae3aadbb9b46083350ad2dc9aea645 (patch)
treeb316db7dee11d1aeee3510562e036fd41705b8b5 /src/main/java/org/junit/runner/manipulation/Sorter.java
parent26401927b83770db45f00706ccc589955644c6c2 (diff)
downloadjunit-aeb93fc33cae3aadbb9b46083350ad2dc9aea645.tar.gz
Upgrade to JUnit 4.12
The license has changed from Common Public License v1.0 to Eclipse Public License v1.0. This will not compile as it is because it is intended to be built against Hamcrest 1.3 or later but it is being built against Hamcrest 1.1. A follow on patch will fix the compilation errors so that it builds against Hamcrest 1.1. That allows Hamcrest to be upgraded separately. The patch can be reverted once Hamcrest has been upgraded. There are also some Android specific issues that will also be fixed in follow on patches. Bug: 33613916 Test: make checkbuild Change-Id: Ic2c983a030399e3ace1a14927cb143fbd8307b4f
Diffstat (limited to 'src/main/java/org/junit/runner/manipulation/Sorter.java')
-rw-r--r--src/main/java/org/junit/runner/manipulation/Sorter.java64
1 files changed, 33 insertions, 31 deletions
diff --git a/src/main/java/org/junit/runner/manipulation/Sorter.java b/src/main/java/org/junit/runner/manipulation/Sorter.java
index 242df14..20192d0 100644
--- a/src/main/java/org/junit/runner/manipulation/Sorter.java
+++ b/src/main/java/org/junit/runner/manipulation/Sorter.java
@@ -7,40 +7,42 @@ import org.junit.runner.Description;
/**
* A <code>Sorter</code> orders tests. In general you will not need
* to use a <code>Sorter</code> directly. Instead, use {@link org.junit.runner.Request#sortWith(Comparator)}.
- *
- *
+ *
+ * @since 4.0
*/
public class Sorter implements Comparator<Description> {
- /**
- * NULL is a <code>Sorter</code> that leaves elements in an undefined order
- */
- public static Sorter NULL= new Sorter(new Comparator<Description>() {
- public int compare(Description o1, Description o2) {
- return 0;
- }});
- private final Comparator<Description> fComparator;
+ /**
+ * NULL is a <code>Sorter</code> that leaves elements in an undefined order
+ */
+ public static final Sorter NULL = new Sorter(new Comparator<Description>() {
+ public int compare(Description o1, Description o2) {
+ return 0;
+ }
+ });
- /**
- * Creates a <code>Sorter</code> that uses <code>comparator</code>
- * to sort tests
- * @param comparator the {@link Comparator} to use when sorting tests
- */
- public Sorter(Comparator<Description> comparator) {
- fComparator= comparator;
- }
+ private final Comparator<Description> comparator;
- /**
- * Sorts the test in <code>runner</code> using <code>comparator</code>
- * @param object
- */
- public void apply(Object object) {
- if (object instanceof Sortable) {
- Sortable sortable = (Sortable) object;
- sortable.sort(this);
- }
- }
+ /**
+ * Creates a <code>Sorter</code> that uses <code>comparator</code>
+ * to sort tests
+ *
+ * @param comparator the {@link Comparator} to use when sorting tests
+ */
+ public Sorter(Comparator<Description> comparator) {
+ this.comparator = comparator;
+ }
- public int compare(Description o1, Description o2) {
- return fComparator.compare(o1, o2);
- }
+ /**
+ * Sorts the test in <code>runner</code> using <code>comparator</code>
+ */
+ public void apply(Object object) {
+ if (object instanceof Sortable) {
+ Sortable sortable = (Sortable) object;
+ sortable.sort(this);
+ }
+ }
+
+ public int compare(Description o1, Description o2) {
+ return comparator.compare(o1, o2);
+ }
}