ImmutableAclEntry implements AclEntry { public static AclEntry fromJson(final JsonObject jsonObject) { checkNotNull(jsonObject, "JSON object"); return jsonObject.stream() .filter(field -> !Objects.equals(field.getKey(), JsonSchemaVersion.getJsonKey())) .findFirst() .map(field -> ImmutableAclEntry.of(field.getKey(), field.getValue())) .orElseThrow(() -> new DittoJsonException(JsonMissingFieldException.newBuilder() .message("The JSON object for 'aclEntry' is missing.") .build())); } private  ImmutableAclEntry(final AuthorizationSubject theAuthSubject, final Set<Permission> thePermissions); static AclEntry of(final AuthorizationSubject authSubject, final Permission permission,
            final Permission... furtherPermissions); static AclEntry of(final AuthorizationSubject authSubject, final Iterable<Permission> permissions); static AclEntry of(final CharSequence jsonKey, final JsonValue jsonValue); static AclEntry fromJson(final JsonObject jsonObject); @Override AuthorizationSubject getAuthorizationSubject(); @Override boolean contains(final Permission permission); @Override boolean containsAll(@Nullable final Collection<Permission> permissions); @Override Permissions getPermissions(); @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 tryToCreateInstanceFromNullJsonObject() { ImmutableAclEntry.fromJson(null); }
@Test(expected = DittoJsonException.class) public void tryToCreateInstanceFromEmptyJsonObject() { ImmutableAclEntry.fromJson(JsonFactory.newObject()); }
@Test(expected = DittoJsonException.class) public void tryToCreateInstanceFromJsonObjectContainingSchemaVersionOnly() { final JsonObject jsonObject = JsonFactory.newObject("{\"__schemaVersion\":1}"); ImmutableAclEntry.fromJson(jsonObject); }
@Test(expected = AclEntryInvalidException.class) public void createInstanceFromJsonObjectContainingOnlyInvalidPermissions() { final JsonObject jsonObject = JsonFactory.newObject("{\"authentication_subject\":{\"BUMLUX\":true}}"); ImmutableAclEntry.fromJson(jsonObject); }