ImmutableAccessControlList implements AccessControlList { @Override public AccessControlList setEntry(final AclEntry aclEntry) { checkNotNull(aclEntry, "entry to be set to this ACL"); final AccessControlList result; final AclEntry existingAclEntry = entries.get(aclEntry.getAuthorizationSubject()); if (null != existingAclEntry) { if (existingAclEntry.equals(aclEntry)) { result = this; } else { final Map<AuthorizationSubject, AclEntry> entriesCopy = copyEntries(); entriesCopy.put(aclEntry.getAuthorizationSubject(), aclEntry); result = new ImmutableAccessControlList(entriesCopy); } } else { final Map<AuthorizationSubject, AclEntry> entriesCopy = copyEntries(); entriesCopy.put(aclEntry.getAuthorizationSubject(), aclEntry); result = new ImmutableAccessControlList(entriesCopy); } return result; } private  ImmutableAccessControlList(final Map<AuthorizationSubject, AclEntry> theEntries); private  ImmutableAccessControlList(final Collection<AclEntry> theEntries); static AccessControlList empty(); static AccessControlList of(final AclEntry entry, final AclEntry... furtherEntries); static AccessControlList of(final Iterable<AclEntry> entries); static AccessControlList fromJson(final JsonObject jsonObject); @Override AccessControlList merge(final AclEntry entry); @Override AccessControlList merge(final AuthorizationSubject authorizationSubject, final Permission permission,
            final Permission... furtherPermissions); @Override AccessControlList merge(final Permission permission, final AuthorizationSubject authorizationSubject,
            final AuthorizationSubject... furtherAuthorizationSubjects); @Override AccessControlList setEntry(final AclEntry aclEntry); @Override AccessControlList setForAllAuthorizationSubjects(final Permissions permissions); @Override Set<AuthorizationSubject> getAuthorizedSubjectsFor(final Permission permission,
            final Permission... furtherPermissions); @Override boolean hasPermission(final AuthorizationContext authorizationContext, final Permission permission,
            final Permission... furtherPermissions); @Override boolean hasPermission(final AuthorizationSubject authorizationSubject, final Permission permission,
            final Permission... furtherPermissions); @Override Set<AuthorizationSubject> getAuthorizedSubjectsFor(final Permissions expectedPermissions); @Override boolean contains(final AuthorizationSubject authorizationSubject); @Override Optional<AclEntry> getEntryFor(final AuthorizationSubject authorizationSubject); @Override Permissions getPermissionsOf(final AuthorizationSubject authorizationSubject); @Override AccessControlList removeEntry(final AclEntry entry); @Override AccessControlList removePermission(final AuthorizationSubject authorizationSubject,
            final Permission permission, final Permission... furtherPermissions); @Override AccessControlList removeAllPermissionsOf(final AuthorizationSubject authorizationSubject); @Override boolean isEmpty(); @Override int getSize(); @Override Set<AclEntry> getEntriesSet(); @Override Stream<AclEntry> stream(); @Override Iterator<AclEntry> iterator(); @Override JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test(expected = NullPointerException.class) public void tryToSetNullAclEntry() { underTest.setEntry(null); }