Skip to content

Commit

Permalink
Using MethodSorter here too, just in case it matters.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Glick committed Jan 31, 2012
1 parent 3920f3f commit 5f2ecda
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.lang.reflect.Method;

import org.hamcrest.BaseMatcher;
import org.junit.internal.MethodSorter;

/**
* Convenient base class for Matchers that require a non-null value of a specific type.
Expand All @@ -26,7 +27,7 @@ protected TypeSafeMatcher() {

private static Class<?> findExpectedType(Class<?> fromClass) {
for (Class<?> c = fromClass; c != Object.class; c = c.getSuperclass()) {
for (Method method : c.getDeclaredMethods()) {
for (Method method : MethodSorter.getDeclaredMethods(c)) {
if (isMatchesSafelyMethod(method)) {
return method.getParameterTypes()[0];
}
Expand Down

0 comments on commit 5f2ecda

Please sign in to comment.