@SuppressWarnings({ "ObjectEqualsNull" }) @Test public void testEquals() { NuxeoGroup group1 = new NuxeoGroupImpl("mygroup"); NuxeoGroup group2 = new NuxeoGroupImpl("mygroup"); NuxeoGroup group3 = new NuxeoGroupImpl("yourgroup", "yourlabel"); assertEquals(group1, group1); assertEquals(group1, group2); assertEquals(group1.hashCode(), group2.hashCode()); assertFalse(group1.equals(null)); assertFalse(group1.equals(group3)); assertEquals("mygroup", group2.getLabel()); group3.setName("mygroup"); assertEquals(group1, group3); assertEquals(group1.hashCode(), group3.hashCode()); }
@Override public boolean equals(Object other) { if (other == this) { return true; } if (other instanceof NuxeoGroupImpl) { String name = getName(); String otherName = ((NuxeoGroupImpl) other).getName(); return Objects.equals(name, otherName); } return false; }
NuxeoGroupImpl implements NuxeoGroup { @Override public boolean equals(Object other) { if (other == this) { return true; } if (other instanceof NuxeoGroupImpl) { String name = getName(); String otherName = ((NuxeoGroupImpl) other).getName(); return Objects.equals(name, otherName); } return false; } }
NuxeoGroupImpl implements NuxeoGroup { @Override public boolean equals(Object other) { if (other == this) { return true; } if (other instanceof NuxeoGroupImpl) { String name = getName(); String otherName = ((NuxeoGroupImpl) other).getName(); return Objects.equals(name, otherName); } return false; } NuxeoGroupImpl(String name);  NuxeoGroupImpl(String name, String label);  NuxeoGroupImpl(DocumentModel model, GroupConfig config); }
NuxeoGroupImpl implements NuxeoGroup { @Override public boolean equals(Object other) { if (other == this) { return true; } if (other instanceof NuxeoGroupImpl) { String name = getName(); String otherName = ((NuxeoGroupImpl) other).getName(); return Objects.equals(name, otherName); } return false; } NuxeoGroupImpl(String name);  NuxeoGroupImpl(String name, String label);  NuxeoGroupImpl(DocumentModel model, GroupConfig config); @SuppressWarnings("unchecked") @Override List<String> getMemberUsers(); @SuppressWarnings("unchecked") @Override List<String> getMemberGroups(); @SuppressWarnings("unchecked") @Override List<String> getParentGroups(); @Override void setMemberUsers(List<String> users); @Override void setMemberGroups(List<String> groups); @Override void setParentGroups(List<String> groups); @Override String getName(); @Override void setName(String name); @Override String getLabel(); @Override void setLabel(String label); @Override DocumentModel getModel(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); }
NuxeoGroupImpl implements NuxeoGroup { @Override public boolean equals(Object other) { if (other == this) { return true; } if (other instanceof NuxeoGroupImpl) { String name = getName(); String otherName = ((NuxeoGroupImpl) other).getName(); return Objects.equals(name, otherName); } return false; } NuxeoGroupImpl(String name);  NuxeoGroupImpl(String name, String label);  NuxeoGroupImpl(DocumentModel model, GroupConfig config); @SuppressWarnings("unchecked") @Override List<String> getMemberUsers(); @SuppressWarnings("unchecked") @Override List<String> getMemberGroups(); @SuppressWarnings("unchecked") @Override List<String> getParentGroups(); @Override void setMemberUsers(List<String> users); @Override void setMemberGroups(List<String> groups); @Override void setParentGroups(List<String> groups); @Override String getName(); @Override void setName(String name); @Override String getLabel(); @Override void setLabel(String label); @Override DocumentModel getModel(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }