@Test void compareToEntitySelectionReferenceNull() { EntitySelection o = new EntitySelection(new EntityReference("A", EntityType.PAGE)); assertEquals(1, o.compareTo(new EntitySelection(null))); }
@Override public int compareTo(EntitySelection entitySelection) { if (entitySelection == null) { throw new NullPointerException("Provided entitySelection should not be null."); } if (entitySelection == this) { return 0; } if (entityReference == null) { return -1; } if (entitySelection.entityReference == null) { return 1; } int result = entityReference.compareTo(entitySelection.entityReference); if (result == 0) { return isSelected.compareTo(entitySelection.isSelected); } else { return result; } }
EntitySelection implements Comparable<EntitySelection> { @Override public int compareTo(EntitySelection entitySelection) { if (entitySelection == null) { throw new NullPointerException("Provided entitySelection should not be null."); } if (entitySelection == this) { return 0; } if (entityReference == null) { return -1; } if (entitySelection.entityReference == null) { return 1; } int result = entityReference.compareTo(entitySelection.entityReference); if (result == 0) { return isSelected.compareTo(entitySelection.isSelected); } else { return result; } } }
EntitySelection implements Comparable<EntitySelection> { @Override public int compareTo(EntitySelection entitySelection) { if (entitySelection == null) { throw new NullPointerException("Provided entitySelection should not be null."); } if (entitySelection == this) { return 0; } if (entityReference == null) { return -1; } if (entitySelection.entityReference == null) { return 1; } int result = entityReference.compareTo(entitySelection.entityReference); if (result == 0) { return isSelected.compareTo(entitySelection.isSelected); } else { return result; } } EntitySelection(EntityReference entityReference); }
EntitySelection implements Comparable<EntitySelection> { @Override public int compareTo(EntitySelection entitySelection) { if (entitySelection == null) { throw new NullPointerException("Provided entitySelection should not be null."); } if (entitySelection == this) { return 0; } if (entityReference == null) { return -1; } if (entitySelection.entityReference == null) { return 1; } int result = entityReference.compareTo(entitySelection.entityReference); if (result == 0) { return isSelected.compareTo(entitySelection.isSelected); } else { return result; } } EntitySelection(EntityReference entityReference); EntityReference getEntityReference(); boolean isSelected(); State getState(); void setSelected(boolean selected); @Override int hashCode(); @Override boolean equals(Object object); @Override int compareTo(EntitySelection entitySelection); }
EntitySelection implements Comparable<EntitySelection> { @Override public int compareTo(EntitySelection entitySelection) { if (entitySelection == null) { throw new NullPointerException("Provided entitySelection should not be null."); } if (entitySelection == this) { return 0; } if (entityReference == null) { return -1; } if (entitySelection.entityReference == null) { return 1; } int result = entityReference.compareTo(entitySelection.entityReference); if (result == 0) { return isSelected.compareTo(entitySelection.isSelected); } else { return result; } } EntitySelection(EntityReference entityReference); EntityReference getEntityReference(); boolean isSelected(); State getState(); void setSelected(boolean selected); @Override int hashCode(); @Override boolean equals(Object object); @Override int compareTo(EntitySelection entitySelection);  }