@Test void testSortingSomeBuilds() { BuildLink build1 = createBuildSuccess("build1", 1); BuildLink build2 = createBuildSuccess("build2", 2); BuildLink build3 = createBuildFailed("build3", 3); BuildLink aliasCurrent = createBuildAlias(Configuration.DEFAULT_ALIAS_FOR_LAST_SUCCESSFUL_BUILD, build2.getBuild()); BuildLink aliasLast = createBuildAlias(Configuration.DEFAULT_ALIAS_FOR_MOST_RECENT_BUILD, build3.getBuild()); List<BuildLink> buildsList = Arrays.asList(build1, build2, build3, aliasCurrent, aliasLast); BuildSorter.sort(buildsList); assertSame(aliasCurrent, buildsList.get(0), "default build alias 'current' expected as first element"); assertSame(aliasLast, buildsList.get(1), "build alias 'last' expected as second element"); assertSame(build3, buildsList.get(2), "build3 expected as first non-aliased build (builds sorted by dates decreasing)"); assertSame(build1, buildsList.get(4), "build1 expected as last non-aliased build (builds sorted by dates decreasing)"); }
public static void sort(final List<BuildLink> builds) { Collections.sort(builds, new BuildSorter()); }
BuildSorter implements Comparator<BuildLink> { public static void sort(final List<BuildLink> builds) { Collections.sort(builds, new BuildSorter()); } }
BuildSorter implements Comparator<BuildLink> { public static void sort(final List<BuildLink> builds) { Collections.sort(builds, new BuildSorter()); }  }
BuildSorter implements Comparator<BuildLink> { public static void sort(final List<BuildLink> builds) { Collections.sort(builds, new BuildSorter()); }  static void sort(final List<BuildLink> builds); @Override int compare(final BuildLink bl1, final BuildLink bl2); }
BuildSorter implements Comparator<BuildLink> { public static void sort(final List<BuildLink> builds) { Collections.sort(builds, new BuildSorter()); }  static void sort(final List<BuildLink> builds); @Override int compare(final BuildLink bl1, final BuildLink bl2);  }