@Test void sortBuildsByDateDescending_givenFourBuilds_theyAreSortedInDescendingOrder() { List<BuildImportSummary> buildsAscending = new LinkedList<>(); buildsAscending.add(BUILD_WITHOUT_DATE); buildsAscending.add(NEWER_BUILD); buildsAscending.add(MIDDLE_BUILD); buildsAscending.add(OLDER_BUILD); List<BuildImportSummary> buildsByDateDescending = BuildByDateSorter.sortBuildsByDateDescending(buildsAscending); assertBuildDescriptionIsEqual(NEWER_BUILD, buildsByDateDescending.get(0)); assertBuildDescriptionIsEqual(MIDDLE_BUILD, buildsByDateDescending.get(1)); assertBuildDescriptionIsEqual(OLDER_BUILD, buildsByDateDescending.get(2)); assertBuildDescriptionIsEqual(BUILD_WITHOUT_DATE, buildsByDateDescending.get(3)); }
public static List<BuildImportSummary> sortBuildsByDateDescending(final Collection<BuildImportSummary> unsortedSummaries) { List<BuildImportSummary> summaries = new LinkedList<BuildImportSummary>(); summaries.addAll(unsortedSummaries); Collections.sort(summaries, new BuildImportSummaryDateDescendingComparator()); return summaries; }
BuildByDateSorter { public static List<BuildImportSummary> sortBuildsByDateDescending(final Collection<BuildImportSummary> unsortedSummaries) { List<BuildImportSummary> summaries = new LinkedList<BuildImportSummary>(); summaries.addAll(unsortedSummaries); Collections.sort(summaries, new BuildImportSummaryDateDescendingComparator()); return summaries; } }
BuildByDateSorter { public static List<BuildImportSummary> sortBuildsByDateDescending(final Collection<BuildImportSummary> unsortedSummaries) { List<BuildImportSummary> summaries = new LinkedList<BuildImportSummary>(); summaries.addAll(unsortedSummaries); Collections.sort(summaries, new BuildImportSummaryDateDescendingComparator()); return summaries; }  }
BuildByDateSorter { public static List<BuildImportSummary> sortBuildsByDateDescending(final Collection<BuildImportSummary> unsortedSummaries) { List<BuildImportSummary> summaries = new LinkedList<BuildImportSummary>(); summaries.addAll(unsortedSummaries); Collections.sort(summaries, new BuildImportSummaryDateDescendingComparator()); return summaries; }  static List<BuildImportSummary> sortBuildsByDateDescending(final Collection<BuildImportSummary> unsortedSummaries); }
BuildByDateSorter { public static List<BuildImportSummary> sortBuildsByDateDescending(final Collection<BuildImportSummary> unsortedSummaries) { List<BuildImportSummary> summaries = new LinkedList<BuildImportSummary>(); summaries.addAll(unsortedSummaries); Collections.sort(summaries, new BuildImportSummaryDateDescendingComparator()); return summaries; }  static List<BuildImportSummary> sortBuildsByDateDescending(final Collection<BuildImportSummary> unsortedSummaries);  }