WhoamiResponse extends CommonCommandResponse<WhoamiResponse> implements WithEntity<WhoamiResponse> { public static WhoamiResponse of(final UserInformation userInformation, final DittoHeaders dittoHeaders) { final JsonObject userInformationJson = checkNotNull(userInformation, "userInformation").toJson(); return new WhoamiResponse(userInformationJson, dittoHeaders); } private  WhoamiResponse(final JsonObject userInformation, final DittoHeaders dittoHeaders); static WhoamiResponse of(final UserInformation userInformation, final DittoHeaders dittoHeaders); static WhoamiResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override WhoamiResponse setDittoHeaders(final DittoHeaders dittoHeaders); @Override WhoamiResponse setEntity(final JsonValue entity); @Override JsonValue getEntity(final JsonSchemaVersion schemaVersion); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override @Nonnull String toString(); @Override @Nonnull JsonSchemaVersion[] getSupportedSchemaVersions(); static final String TYPE; }
@Test public void of() { final WhoamiResponse response = WhoamiResponse.of(USER_INFORMATION, DITTO_HEADERS); assertThat(response.getDittoHeaders()).isEqualTo(DITTO_HEADERS); assertThat(response.getEntity()).isEqualTo(USER_INFORMATION.toJson()); }
@Test public void toJsonReturnsExpected() { final WhoamiResponse response = WhoamiResponse.of(USER_INFORMATION, DITTO_HEADERS); final JsonObject actualJson = response.toJson(); assertThat(actualJson).isEqualTo(KNOWN_JSON); }