RetrieveSubjectResponse extends AbstractCommandResponse<RetrieveSubjectResponse> implements
        PolicyQueryCommandResponse<RetrieveSubjectResponse> { @Deprecated public static RetrieveSubjectResponse of(final String policyId, final Label label, final String subjectId, final JsonObject subject, final DittoHeaders dittoHeaders) { return of(PolicyId.of(policyId), label, subjectId, subject, dittoHeaders); } private  RetrieveSubjectResponse(final PolicyId policyId,
            final Label label,
            final String subjectId,
            final JsonObject subject,
            final HttpStatusCode statusCode,
            final DittoHeaders dittoHeaders); @Deprecated static RetrieveSubjectResponse of(final String policyId,
            final Label label,
            final String subjectId,
            final JsonObject subject,
            final DittoHeaders dittoHeaders); static RetrieveSubjectResponse of(final PolicyId policyId,
            final Label label,
            final String subjectId,
            final JsonObject subject,
            final DittoHeaders dittoHeaders); @Deprecated static RetrieveSubjectResponse of(final String policyId,
            final Label label,
            final Subject subject,
            final DittoHeaders dittoHeaders); static RetrieveSubjectResponse of(final PolicyId policyId,
            final Label label,
            final Subject subject,
            final DittoHeaders dittoHeaders); static RetrieveSubjectResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders); static RetrieveSubjectResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override PolicyId getEntityId(); Label getLabel(); Subject getSubject(); @Override JsonValue getEntity(final JsonSchemaVersion schemaVersion); @Override RetrieveSubjectResponse setEntity(final JsonValue entity); @Override RetrieveSubjectResponse setDittoHeaders(final DittoHeaders dittoHeaders); @Override JsonPointer getResourcePath(); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString(); static final String TYPE; }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullJsonObject() { RetrieveSubjectResponse.of(TestConstants.Policy.POLICY_ID, TestConstants.Policy.LABEL, "fo:bar", null, EMPTY_DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullSubjectId() { RetrieveSubjectResponse.of(TestConstants.Policy.POLICY_ID, TestConstants.Policy.LABEL, null, JsonFactory.newObjectBuilder().build(), EMPTY_DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullSubject() { RetrieveSubjectResponse.of(TestConstants.Policy.POLICY_ID, TestConstants.Policy.LABEL, null, EMPTY_DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final RetrieveSubjectResponse underTest = RetrieveSubjectResponse.of(TestConstants.Policy.POLICY_ID, TestConstants.Policy.LABEL, TestConstants.Policy.SUBJECT, EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }