MethodComparator implements Comparator<ExecutableElement> { int compareByArgument(ExecutableElement o1, ExecutableElement o2) { return o2.getParameters().size() - o1.getParameters().size(); }  @Override int compare(ExecutableElement o1, ExecutableElement o2);  }
@Test public void compareByArgumentTest() { System.out.println("compareByArgument"); int size1 = 2; int size2 = 3; ExecutableElement o1 = mock(ExecutableElement.class); ExecutableElement o2 = mock(ExecutableElement.class); List l1 = mock(List.class); List l2 = mock(List.class); when(o1.getParameters()).thenReturn(l1); when(o2.getParameters()).thenReturn(l2); when(l1.size()).thenReturn(size1); when(l2.size()).thenReturn(size2); int result = instance.compareByArgument(o1, o2); assertThat(result).isPositive(); result = instance.compareByArgument(o2, o1); assertThat(result).isNegative(); result = instance.compareByArgument(o1, o1); assertThat(result).isZero(); }