@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()); Calendar begin = new GregorianCalendar(2015, Calendar.JULY, 14, 12, 34, 56); Calendar end = new GregorianCalendar(2015, Calendar.AUGUST, 14, 12, 34, 56); ACE ace6 = ACE.builder("leela", "read").isGranted(false).begin(begin).end(end).build(); ACE ace7 = ACE.builder("leela", "read").isGranted(false).begin(begin).end(end).build(); assertEquals(ace6, ace7); ACE ace8 = ACE.fromId(ace7.getId()); assertEquals(ace6, ace8); ACE ace9 = new ACE("john", null, false); ACE ace10 = new ACE("jane", null, true); ACE ace11 = new ACE("john", null, false); assertFalse(ace9.equals(ace10)); assertTrue(ace9.equals(ace11)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ACE) { ACE ace = (ACE) obj; boolean beginEqual = ace.begin == null && begin == null || !(ace.begin == null || begin == null) && ace.begin.getTimeInMillis() == begin.getTimeInMillis(); boolean endEqual = ace.end == null && end == null || !(ace.end == null || end == null) && ace.end.getTimeInMillis() == end.getTimeInMillis(); boolean creatorEqual = Objects.equals(ace.creator, creator); boolean usernameEqual = Objects.equals(ace.username, username); boolean permissionEqual = Objects.equals(ace.permission, permission); return ace.isGranted == isGranted && usernameEqual && permissionEqual && creatorEqual && beginEqual && endEqual; } return super.equals(obj); }
ACE implements Serializable, Cloneable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ACE) { ACE ace = (ACE) obj; boolean beginEqual = ace.begin == null && begin == null || !(ace.begin == null || begin == null) && ace.begin.getTimeInMillis() == begin.getTimeInMillis(); boolean endEqual = ace.end == null && end == null || !(ace.end == null || end == null) && ace.end.getTimeInMillis() == end.getTimeInMillis(); boolean creatorEqual = Objects.equals(ace.creator, creator); boolean usernameEqual = Objects.equals(ace.username, username); boolean permissionEqual = Objects.equals(ace.permission, permission); return ace.isGranted == isGranted && usernameEqual && permissionEqual && creatorEqual && beginEqual && endEqual; } return super.equals(obj); } }
ACE implements Serializable, Cloneable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ACE) { ACE ace = (ACE) obj; boolean beginEqual = ace.begin == null && begin == null || !(ace.begin == null || begin == null) && ace.begin.getTimeInMillis() == begin.getTimeInMillis(); boolean endEqual = ace.end == null && end == null || !(ace.end == null || end == null) && ace.end.getTimeInMillis() == end.getTimeInMillis(); boolean creatorEqual = Objects.equals(ace.creator, creator); boolean usernameEqual = Objects.equals(ace.username, username); boolean permissionEqual = Objects.equals(ace.permission, permission); return ace.isGranted == isGranted && usernameEqual && permissionEqual && creatorEqual && beginEqual && endEqual; } return super.equals(obj); } ACE();  ACE(String username, String permission, boolean isGranted);  ACE(String username, String permission);   ACE(String username, String permission, boolean isGranted, String creator, Calendar begin, Calendar end,
            Map<String, Serializable> contextData); }
ACE implements Serializable, Cloneable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ACE) { ACE ace = (ACE) obj; boolean beginEqual = ace.begin == null && begin == null || !(ace.begin == null || begin == null) && ace.begin.getTimeInMillis() == begin.getTimeInMillis(); boolean endEqual = ace.end == null && end == null || !(ace.end == null || end == null) && ace.end.getTimeInMillis() == end.getTimeInMillis(); boolean creatorEqual = Objects.equals(ace.creator, creator); boolean usernameEqual = Objects.equals(ace.username, username); boolean permissionEqual = Objects.equals(ace.permission, permission); return ace.isGranted == isGranted && usernameEqual && permissionEqual && creatorEqual && beginEqual && endEqual; } return super.equals(obj); } ACE();  ACE(String username, String permission, boolean isGranted);  ACE(String username, String permission);   ACE(String username, String permission, boolean isGranted, String creator, Calendar begin, Calendar end,
            Map<String, Serializable> contextData); static ACE fromId(String aceId); String getId(); String getUsername(); String getPermission(); boolean isGranted(); boolean isDenied(); Calendar getBegin(); void setBegin(Calendar begin); Calendar getEnd(); void setEnd(Calendar end); String getCreator(); void setCreator(String creator); Status getStatus(); Long getLongStatus(); boolean isEffective(); boolean isPending(); boolean isArchived(); Serializable getContextData(String key); void putContextData(String key, Serializable value); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @Override Object clone(); static ACEBuilder builder(ACE ace); static ACEBuilder builder(String username, String permission); }
ACE implements Serializable, Cloneable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ACE) { ACE ace = (ACE) obj; boolean beginEqual = ace.begin == null && begin == null || !(ace.begin == null || begin == null) && ace.begin.getTimeInMillis() == begin.getTimeInMillis(); boolean endEqual = ace.end == null && end == null || !(ace.end == null || end == null) && ace.end.getTimeInMillis() == end.getTimeInMillis(); boolean creatorEqual = Objects.equals(ace.creator, creator); boolean usernameEqual = Objects.equals(ace.username, username); boolean permissionEqual = Objects.equals(ace.permission, permission); return ace.isGranted == isGranted && usernameEqual && permissionEqual && creatorEqual && beginEqual && endEqual; } return super.equals(obj); } ACE();  ACE(String username, String permission, boolean isGranted);  ACE(String username, String permission);   ACE(String username, String permission, boolean isGranted, String creator, Calendar begin, Calendar end,
            Map<String, Serializable> contextData); static ACE fromId(String aceId); String getId(); String getUsername(); String getPermission(); boolean isGranted(); boolean isDenied(); Calendar getBegin(); void setBegin(Calendar begin); Calendar getEnd(); void setEnd(Calendar end); String getCreator(); void setCreator(String creator); Status getStatus(); Long getLongStatus(); boolean isEffective(); boolean isPending(); boolean isArchived(); Serializable getContextData(String key); void putContextData(String key, Serializable value); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @Override Object clone(); static ACEBuilder builder(ACE ace); static ACEBuilder builder(String username, String permission); static final ACE BLOCK; }