@Test public void testCompareWhenEqualGroupAndPerson() { Date sharedDate = new Date(); PersonModelView pmv = new PersonModelView(1L, "persona", "Person", "A", "hey now", "", 50, sharedDate, 1L); DomainGroupModelView gmv = new DomainGroupModelView(1L, "groupb", "Group B", 50L, sharedDate, 2L); Assert.assertTrue(sut.compare(pmv, gmv) > 0); Assert.assertTrue(sut.compare(gmv, pmv) < 0); }
@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);  }