@Test public void testCompareWhenEqualGroupAndPerson() { PersonModelView pmv = new PersonModelView(1L, "persona", "Person", "last", null, "", 50, new Date(), 4L); DomainGroupModelView gmv = new DomainGroupModelView(1L, "groupb", "Group B", 50L, new Date(), 5L); 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.getFollowersCount() == inB.getFollowersCount()) { if (inA.getEntityType() == EntityType.GROUP && inB.getEntityType() == EntityType.PERSON) { return -1; } if (inA.getEntityType() == EntityType.PERSON && inB.getEntityType() == EntityType.GROUP) { return 1; } return inA.getUniqueId().compareTo(inB.getUniqueId()); } if (inA.getFollowersCount() > inB.getFollowersCount()) { return -1; } return 1; }
StreamDTOFollowerCountDescendingComparator implements Comparator<StreamDTO> { @Override public int compare(final StreamDTO inA, final StreamDTO inB) { if (inA.getFollowersCount() == inB.getFollowersCount()) { if (inA.getEntityType() == EntityType.GROUP && inB.getEntityType() == EntityType.PERSON) { return -1; } if (inA.getEntityType() == EntityType.PERSON && inB.getEntityType() == EntityType.GROUP) { return 1; } return inA.getUniqueId().compareTo(inB.getUniqueId()); } if (inA.getFollowersCount() > inB.getFollowersCount()) { return -1; } return 1; } }
StreamDTOFollowerCountDescendingComparator implements Comparator<StreamDTO> { @Override public int compare(final StreamDTO inA, final StreamDTO inB) { if (inA.getFollowersCount() == inB.getFollowersCount()) { if (inA.getEntityType() == EntityType.GROUP && inB.getEntityType() == EntityType.PERSON) { return -1; } if (inA.getEntityType() == EntityType.PERSON && inB.getEntityType() == EntityType.GROUP) { return 1; } return inA.getUniqueId().compareTo(inB.getUniqueId()); } if (inA.getFollowersCount() > inB.getFollowersCount()) { return -1; } return 1; }  }
StreamDTOFollowerCountDescendingComparator implements Comparator<StreamDTO> { @Override public int compare(final StreamDTO inA, final StreamDTO inB) { if (inA.getFollowersCount() == inB.getFollowersCount()) { if (inA.getEntityType() == EntityType.GROUP && inB.getEntityType() == EntityType.PERSON) { return -1; } if (inA.getEntityType() == EntityType.PERSON && inB.getEntityType() == EntityType.GROUP) { return 1; } return inA.getUniqueId().compareTo(inB.getUniqueId()); } if (inA.getFollowersCount() > inB.getFollowersCount()) { return -1; } return 1; }  @Override int compare(final StreamDTO inA, final StreamDTO inB); }
StreamDTOFollowerCountDescendingComparator implements Comparator<StreamDTO> { @Override public int compare(final StreamDTO inA, final StreamDTO inB) { if (inA.getFollowersCount() == inB.getFollowersCount()) { if (inA.getEntityType() == EntityType.GROUP && inB.getEntityType() == EntityType.PERSON) { return -1; } if (inA.getEntityType() == EntityType.PERSON && inB.getEntityType() == EntityType.GROUP) { return 1; } return inA.getUniqueId().compareTo(inB.getUniqueId()); } if (inA.getFollowersCount() > inB.getFollowersCount()) { return -1; } return 1; }  @Override int compare(final StreamDTO inA, final StreamDTO inB);  }