PsModelNameComparator implements Comparator<T> { @Override public int compare(T m1, T m2) { return m1.getName().compareTo(m2.getName()); }  @Override int compare(T m1, T m2);  }
@Test public void compare() throws Exception { PsModel a = new TestModel("a"); PsModel b = new TestModel("b"); assertThat(myComparator.compare(a, b)).isLessThan(0); assertThat(myComparator.compare(b, a)).isGreaterThan(0); }
@Test public void compare_equals() throws Exception { PsModel a = new TestModel("a"); PsModel b = new TestModel("a"); assertEquals(0, myComparator.compare(a, a)); assertEquals(0, myComparator.compare(a, b)); }