TrackComparator implements Comparator<Track> { @Override public int compare(Track track1, Track track2) { return Integer.compare(track1.index(), track2.index()); }  @Override int compare(Track track1, Track track2);  }
@Test public void compareTracks() { Track track1 = createTrackWithIndex(10); Track track2 = createTrackWithIndex(11); int result = comparator.compare(track1, track2); assertThat(result, lessThan(0)); }
@Test public void compareTracksSameIndex() { Track track1 = createTrackWithIndex(10); Track track2 = createTrackWithIndex(10); int result = comparator.compare(track1, track2); assertThat(result, comparesEqualTo(0)); }