Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Compare full signature of methods with same name.

When sorting methods in ascending order, compare the full signature
if the methods have the same name.
  • Loading branch information...
commit 7a0ffd8e80630806a19a0a27ac680ebb11360f3d 1 parent 6f74b19
@sl4mmy authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/main/java/org/junit/internal/MethodSorter.java
View
7 src/main/java/org/junit/internal/MethodSorter.java
@@ -26,7 +26,12 @@ public int compare(Method m1, Method m2) {
*/
public static Comparator<Method> NAME_ASCENDING= new Comparator<Method>() {
public int compare(Method m1, Method m2) {
- return MethodSorter.compare(m1.getName(), m2.getName());
+ String n1 = m1.getName();
+ String n2 = m2.getName();
+ if (!n1.equals(n2)) {
+ return MethodSorter.compare(m1.getName(), m2.getName());
+ }
+ return MethodSorter.compare(m1.toString(), m2.toString());
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.