ACE implements Serializable, Cloneable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ACE) { ACE ace = (ACE) obj; return ace.isGranted == isGranted && ace.username.equals(username) && ace.permission.equals(permission); } return super.equals(obj); } ACE(String username, String permission);  ACE(String username, String permission, boolean isGranted);  ACE(); String getUsername(); String getPermission(); boolean isGranted(); boolean isDenied(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @Override Object clone(); static final ACE BLOCK; }
@SuppressWarnings({"ObjectEqualsNull"}) @Test public void testEquals() { ACE ace2 = new ACE("bogdan", "write", false); ACE ace3 = new ACE("raoul", "write", false); ACE ace4 = new ACE("bogdan", "read", false); ACE ace5 = new ACE("bogdan", "write", true); assertEquals(ace, ace); assertEquals(ace, ace2); assertEquals(ace2, ace); assertFalse(ace.equals(null)); assertFalse(ace.equals(ace3)); assertFalse(ace.equals(ace4)); assertFalse(ace.equals(ace5)); assertEquals(ace.hashCode(), ace2.hashCode()); }