### Question:
Acl { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Acl)) { return false; } Acl other = (Acl) obj; return Objects.equals(inheritFrom, other.inheritFrom) && Objects.equals(inheritType, other.inheritType) && Objects.equals(inheritFromFragment, other.inheritFromFragment) && Objects.equals(readers, other.readers) && Objects.equals(deniedReaders, other.deniedReaders) && Objects.equals(owners, other.owners); } private  Acl(Builder builder); Set<Principal> getReaders(); Set<Principal> getDeniedReaders(); Set<Principal> getOwners(); String getInheritFrom(); String getInheritFromFragment(); InheritanceType getInheritanceType(); Item createFragmentItemOf(String id, String fragment); Item applyTo(Item item); static String fragmentId(String id, String fragment); static String getPrincipalName(String name, String namespace); static Principal getGoogleUserPrincipal(String userId); static Principal getGoogleGroupPrincipal(String groupId); static Principal getCustomerPrincipal(); static Principal getUserPrincipal(String userId); static Principal getUserPrincipal(String userId, String identitySourceId); static Principal getGroupPrincipal(String groupId); static Principal getGroupPrincipal(String groupId, String identitySourceId); static boolean addResourcePrefixUser(Principal user, String identitySourceId); static boolean addResourcePrefixGroup(Principal group, String identitySourceId); static PrincipalType getPrincipalType(Principal p); static Acl createAcl(String permittedUsers, String permittedGroups, String deniedUsers,
      String deniedGroups); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static final String IDENTITY_SOURCES_PREFIX; static final String IDENTITY_RESOURCE_NAME_FORMAT; static final String USER_RESOURCE_NAME_FORMAT; static final String GROUP_NAME_FORMAT; static final UserPrincipalParser USER_PARSER; static final GroupPrincipalParser GROUP_PARSER; static final String GOOGLE_ACCOUNT_PREFIX; }### Answer:
@Test public void testEqualsNegative() { Acl acl = new Acl.Builder() .setReaders(user("AllowedUser1", "AllowedUser2")) .setDeniedReaders(group("DeniedGroup")) .setOwners(user("AllowedUser1")).build(); assertEquals(acl, acl); assertFalse(acl.equals(null)); assertFalse(acl.equals(new Acl.Builder())); }
@Test public void testEquals() { Acl acl1 = new Acl.Builder() .setInheritFrom("inheritFrom") .setInheritanceType(InheritanceType.CHILD_OVERRIDE) .setOwners(Collections.singleton(new Principal().setUserResourceName("#owner"))) .setReaders( Arrays.asList( new Principal().setUserResourceName("#AllowedUser1"), new Principal().setUserResourceName("#AllowedUser2"))) .setDeniedReaders( Collections.singleton(new Principal().setGroupResourceName("#DeniedGroup"))) .build(); Acl acl2 = new Acl.Builder() .setInheritFrom("inheritFrom") .setInheritanceType(InheritanceType.CHILD_OVERRIDE) .setOwners(Collections.singleton(new Principal().setUserResourceName("#owner"))) .setReaders( Arrays.asList( new Principal().setUserResourceName("#AllowedUser2"), new Principal().setUserResourceName("#AllowedUser2"), new Principal().setUserResourceName("#AllowedUser1"))) .setDeniedReaders( Collections.singleton(new Principal().setGroupResourceName("#DeniedGroup"))) .build(); assertEquals(acl1, acl2); assertEquals(acl1.hashCode(), acl2.hashCode()); }