@Test public void equalsWithNullUserTest() { Owner o = new DefaultOwner(null, this.helper); Assert.assertTrue(o.equals(o)); Assert.assertFalse(o.equals(null)); Owner other = new DefaultOwner(null, this.helper); Assert.assertTrue(o.equals(other)); Assert.assertTrue(other.equals(o)); other = new DefaultOwner(new DocumentReference("xwiki", "XWiki", "padams"), this.helper); Assert.assertFalse(o.equals(other)); Assert.assertFalse(other.equals(o)); Assert.assertFalse(o.equals("other")); }
@Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || getClass() != other.getClass()) { return false; } Owner otherCollaborator = (Owner) other; return Objects.equals(this.user, otherCollaborator.getUser()); }
DefaultOwner implements Owner { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || getClass() != other.getClass()) { return false; } Owner otherCollaborator = (Owner) other; return Objects.equals(this.user, otherCollaborator.getUser()); } }
DefaultOwner implements Owner { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || getClass() != other.getClass()) { return false; } Owner otherCollaborator = (Owner) other; return Objects.equals(this.user, otherCollaborator.getUser()); } DefaultOwner(EntityReference user, EntityAccessHelper helper); }
DefaultOwner implements Owner { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || getClass() != other.getClass()) { return false; } Owner otherCollaborator = (Owner) other; return Objects.equals(this.user, otherCollaborator.getUser()); } DefaultOwner(EntityReference user, EntityAccessHelper helper); @Override String getType(); @Override boolean isUser(); @Override boolean isGroup(); @Override EntityReference getUser(); @Override String getUsername(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); }
DefaultOwner implements Owner { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || getClass() != other.getClass()) { return false; } Owner otherCollaborator = (Owner) other; return Objects.equals(this.user, otherCollaborator.getUser()); } DefaultOwner(EntityReference user, EntityAccessHelper helper); @Override String getType(); @Override boolean isUser(); @Override boolean isGroup(); @Override EntityReference getUser(); @Override String getUsername(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }