Skip to content

Commit

Permalink
Removed Comparators.reverse(); it's broken and the JDK provides a bet…
Browse files Browse the repository at this point in the history
…ter version
  • Loading branch information
kcooney committed Jun 2, 2018
1 parent ca3e040 commit 3e6d464
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
8 changes: 0 additions & 8 deletions src/test/java/org/junit/tests/manipulation/Comparators.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,4 @@ private Comparators() {}
public static Comparator<Description> alphanumeric() {
return ALPHANUMERIC;
}

public static Comparator<Description> reverse(final Comparator<Description> comparator) {
return new Comparator<Description>() {
public int compare(Description o1, Description o2) {
return ALPHANUMERIC.compare(o2, o1);
}
};
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.junit.tests.manipulation;

import static java.util.Collections.reverseOrder;

import org.junit.runner.manipulation.Ordering;

/**
Expand All @@ -9,7 +11,7 @@ public final class ReverseAlphanumericOrdering extends ComparatorBasedOrdering
implements Ordering.Factory {

public ReverseAlphanumericOrdering() {
super(Comparators.reverse(Comparators.alphanumeric()));
super(reverseOrder(Comparators.alphanumeric()));
}

public Ordering create(Context context) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.junit.tests.manipulation;

import static java.util.Collections.reverseOrder;

import org.junit.runner.manipulation.Ordering;
import org.junit.runner.manipulation.Sorter;

Expand All @@ -9,6 +11,6 @@
public final class ReverseAlphanumericSorter implements Ordering.Factory {

public Ordering create(Ordering.Context context) {
return new Sorter(Comparators.reverse(Comparators.alphanumeric()));
return new Sorter(reverseOrder(Comparators.alphanumeric()));
}
}
3 changes: 2 additions & 1 deletion src/test/java/org/junit/tests/manipulation/SortableTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.junit.tests.manipulation;

import static java.util.Collections.reverseOrder;
import static org.junit.Assert.assertEquals;

import java.util.Comparator;
Expand All @@ -26,7 +27,7 @@ private static Comparator<Description> forward() {
}

private static Comparator<Description> backward() {
return Comparators.reverse(Comparators.alphanumeric());
return reverseOrder(Comparators.alphanumeric());
}

public static class TestClassRunnerIsSortable {
Expand Down

0 comments on commit 3e6d464

Please sign in to comment.