@Test public void testCompare_TwoBeforeOne() throws Exception { BackupSummary summary1 = newBackupSummary(); summary1.setCreated(Dates.thenUtc(2000,1,1,0,0,0)); BackupSummary summary2 = newBackupSummary(); summary2.setCreated(Dates.thenUtc(2000,1,1,0,0,1)); BackupSummaryDescendingComparator testObject = new BackupSummaryDescendingComparator(); assertThat(testObject.compare(summary1, summary2)).isEqualTo(1); }
@Override public int compare(BackupSummary o1, BackupSummary o2) { if (o1 == null && o2 != null) { return -1; } if (o2 == null) { return 1; } if (o1.getCreated() == null && o2.getCreated() != null) { return -1; } if (o2.getCreated() == null) { return 1; } return o2.getCreated().compareTo(o1.getCreated()); }
BackupSummaryDescendingComparator implements Comparator<BackupSummary>, Serializable { @Override public int compare(BackupSummary o1, BackupSummary o2) { if (o1 == null && o2 != null) { return -1; } if (o2 == null) { return 1; } if (o1.getCreated() == null && o2.getCreated() != null) { return -1; } if (o2.getCreated() == null) { return 1; } return o2.getCreated().compareTo(o1.getCreated()); } }
BackupSummaryDescendingComparator implements Comparator<BackupSummary>, Serializable { @Override public int compare(BackupSummary o1, BackupSummary o2) { if (o1 == null && o2 != null) { return -1; } if (o2 == null) { return 1; } if (o1.getCreated() == null && o2.getCreated() != null) { return -1; } if (o2.getCreated() == null) { return 1; } return o2.getCreated().compareTo(o1.getCreated()); }  }
BackupSummaryDescendingComparator implements Comparator<BackupSummary>, Serializable { @Override public int compare(BackupSummary o1, BackupSummary o2) { if (o1 == null && o2 != null) { return -1; } if (o2 == null) { return 1; } if (o1.getCreated() == null && o2.getCreated() != null) { return -1; } if (o2.getCreated() == null) { return 1; } return o2.getCreated().compareTo(o1.getCreated()); }  @Override int compare(BackupSummary o1, BackupSummary o2); }
BackupSummaryDescendingComparator implements Comparator<BackupSummary>, Serializable { @Override public int compare(BackupSummary o1, BackupSummary o2) { if (o1 == null && o2 != null) { return -1; } if (o2 == null) { return 1; } if (o1.getCreated() == null && o2.getCreated() != null) { return -1; } if (o2.getCreated() == null) { return 1; } return o2.getCreated().compareTo(o1.getCreated()); }  @Override int compare(BackupSummary o1, BackupSummary o2);  }