@Test void equals() { EntityReference entityReference = new EntityReference("test", EntityType.PAGE); EntitySelection selected = new EntitySelection(entityReference); EntitySelection unselected = new EntitySelection(entityReference); unselected.setSelected(false); assertFalse(selected.equals(null)); assertTrue(selected.equals(selected)); assertFalse(selected.equals(entityReference)); assertFalse(selected.equals(unselected)); assertTrue(selected.equals(new EntitySelection(entityReference))); }
@Override public boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } if (object.getClass() != getClass()) { return false; } EntitySelection entitySelection = (EntitySelection) object; return new EqualsBuilder().append(getEntityReference(), entitySelection.getEntityReference()) .append(isSelected(), entitySelection.isSelected()).isEquals(); }
EntitySelection implements Comparable<EntitySelection> { @Override public boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } if (object.getClass() != getClass()) { return false; } EntitySelection entitySelection = (EntitySelection) object; return new EqualsBuilder().append(getEntityReference(), entitySelection.getEntityReference()) .append(isSelected(), entitySelection.isSelected()).isEquals(); } }
EntitySelection implements Comparable<EntitySelection> { @Override public boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } if (object.getClass() != getClass()) { return false; } EntitySelection entitySelection = (EntitySelection) object; return new EqualsBuilder().append(getEntityReference(), entitySelection.getEntityReference()) .append(isSelected(), entitySelection.isSelected()).isEquals(); } EntitySelection(EntityReference entityReference); }
EntitySelection implements Comparable<EntitySelection> { @Override public boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } if (object.getClass() != getClass()) { return false; } EntitySelection entitySelection = (EntitySelection) object; return new EqualsBuilder().append(getEntityReference(), entitySelection.getEntityReference()) .append(isSelected(), entitySelection.isSelected()).isEquals(); } 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 boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } if (object.getClass() != getClass()) { return false; } EntitySelection entitySelection = (EntitySelection) object; return new EqualsBuilder().append(getEntityReference(), entitySelection.getEntityReference()) .append(isSelected(), entitySelection.isSelected()).isEquals(); } 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);  }