@Test public void testCompareWhenTwoPeopleEqual() { Date sharedDate = new Date(); PersonModelView pmv1 = new PersonModelView(1L, "persona", "Person", "A", "hey now", "", 50, sharedDate, 3L); PersonModelView pmv2 = new PersonModelView(2L, "personb", "Person", "B", "hey now", "", 50, sharedDate, 4L); Assert.assertEquals(0, sut.compare(pmv1, pmv2)); }
@Override public int compare(final StreamDTO inA, final StreamDTO inB) { if (inA.getDateAdded().compareTo(inB.getDateAdded()) == 0) { if (inA.getEntityType() == EntityType.GROUP && inB.getEntityType() == EntityType.PERSON) { return -1; } if (inA.getEntityType() == EntityType.PERSON && inB.getEntityType() == EntityType.GROUP) { return 1; } return 0; } return inB.getDateAdded().compareTo(inA.getDateAdded()); }
StreamDTODateAddedDescendingComparator implements Comparator<StreamDTO> { @Override public int compare(final StreamDTO inA, final StreamDTO inB) { if (inA.getDateAdded().compareTo(inB.getDateAdded()) == 0) { if (inA.getEntityType() == EntityType.GROUP && inB.getEntityType() == EntityType.PERSON) { return -1; } if (inA.getEntityType() == EntityType.PERSON && inB.getEntityType() == EntityType.GROUP) { return 1; } return 0; } return inB.getDateAdded().compareTo(inA.getDateAdded()); } }
StreamDTODateAddedDescendingComparator implements Comparator<StreamDTO> { @Override public int compare(final StreamDTO inA, final StreamDTO inB) { if (inA.getDateAdded().compareTo(inB.getDateAdded()) == 0) { if (inA.getEntityType() == EntityType.GROUP && inB.getEntityType() == EntityType.PERSON) { return -1; } if (inA.getEntityType() == EntityType.PERSON && inB.getEntityType() == EntityType.GROUP) { return 1; } return 0; } return inB.getDateAdded().compareTo(inA.getDateAdded()); }  }
StreamDTODateAddedDescendingComparator implements Comparator<StreamDTO> { @Override public int compare(final StreamDTO inA, final StreamDTO inB) { if (inA.getDateAdded().compareTo(inB.getDateAdded()) == 0) { if (inA.getEntityType() == EntityType.GROUP && inB.getEntityType() == EntityType.PERSON) { return -1; } if (inA.getEntityType() == EntityType.PERSON && inB.getEntityType() == EntityType.GROUP) { return 1; } return 0; } return inB.getDateAdded().compareTo(inA.getDateAdded()); }  @Override int compare(final StreamDTO inA, final StreamDTO inB); }
StreamDTODateAddedDescendingComparator implements Comparator<StreamDTO> { @Override public int compare(final StreamDTO inA, final StreamDTO inB) { if (inA.getDateAdded().compareTo(inB.getDateAdded()) == 0) { if (inA.getEntityType() == EntityType.GROUP && inB.getEntityType() == EntityType.PERSON) { return -1; } if (inA.getEntityType() == EntityType.PERSON && inB.getEntityType() == EntityType.GROUP) { return 1; } return 0; } return inB.getDateAdded().compareTo(inA.getDateAdded()); }  @Override int compare(final StreamDTO inA, final StreamDTO inB);  }