KentBeck/junit — pull request #555 by avandeursen (2012-11-20 08:59:16+00:00)
Title: Fix for MethodSorterTest so that coverage can be measured (issue #551)

**The issue:**
With [Jacoco](http://www.eclemma.org/jacoco/) (formerly eclemma) code coverage enabled in Eclipse, the `org.junit.internal.MethodSorterTest` failed on
* `getMethodsNullSorter`
* `testDefaultSorter`
* `testNameAsc`

The cause was that via reflection methods were collected from static classes. These included temporary methods generated by the coverage tool, which were not expected by the test causing the test to fail.

**The fix**
To fix this, I filter methods before comparison, to just the methods actually declared. This is done by the new `getDeclaredFilteredMethods` helper method. As a result, all tests pass both with and without coverage analysis enabled.

I also applied some small refactorings. I extracted separate test cases for method sorting on sub and superclasses (which were included in the null sorter test case). Furthermore, I based all equality checks directly on lists or arrays, instead of on the `toString` representation of objects.