DefaultUserInformation implements UserInformation { @Override public JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> predicate) { final JsonObjectBuilder builder = JsonFactory.newObjectBuilder(); builder.set(JsonFields.DEFAULT_SUBJECT, defaultSubject); builder.set(JsonFields.SUBJECTS, subjects.stream().map(JsonValue::of).collect(JsonCollectors.valuesToArray())); return builder.build(); } private  DefaultUserInformation(@Nullable final String defaultSubject,
            final List<String> subjects); static DefaultUserInformation fromAuthorizationContext(final AuthorizationContext context); static DefaultUserInformation fromJson(final JsonObject jsonObject); @Override Optional<String> getDefaultSubject(); @Override List<String> getSubjects(); @Override JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> predicate); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString();  }
@Test public void toJson() { final String defaultSubjectId = "google:i-am-user"; final String otherSubjectId = "eclipse:i-am-not-google"; final JsonObject json = JsonFactory.newObjectBuilder() .set("defaultSubject", defaultSubjectId) .set("subjects", JsonArray.of(defaultSubjectId, otherSubjectId)) .build(); final DefaultUserInformation userInformation = DefaultUserInformation.fromJson(json); assertThat(userInformation.toJson()).isEqualTo(json); }