@Test public void hashCodeTest() throws ComponentLookupException { Owner o = new DefaultOwner(OWNER, this.helper); Owner other = new DefaultOwner(OWNER, this.helper); Assert.assertEquals(o.hashCode(), other.hashCode()); other = new DefaultOwner(new DocumentReference("xwiki", "XWiki", "padams"), this.helper); Assert.assertNotEquals(o.hashCode(), other.hashCode()); other = new DefaultOwner(null, this.helper); Assert.assertNotEquals(o.hashCode(), other.hashCode()); o = new DefaultOwner(null, this.helper); Assert.assertEquals(o.hashCode(), other.hashCode()); }
@Override public int hashCode() { return this.user != null ? this.user.hashCode() : 0; }
DefaultOwner implements Owner { @Override public int hashCode() { return this.user != null ? this.user.hashCode() : 0; } }
DefaultOwner implements Owner { @Override public int hashCode() { return this.user != null ? this.user.hashCode() : 0; } DefaultOwner(EntityReference user, EntityAccessHelper helper); }
DefaultOwner implements Owner { @Override public int hashCode() { return this.user != null ? this.user.hashCode() : 0; } 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 int hashCode() { return this.user != null ? this.user.hashCode() : 0; } 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();  }