CreatePolicyResponse extends AbstractCommandResponse<CreatePolicyResponse> implements PolicyModifyCommandResponse<CreatePolicyResponse> { public static CreatePolicyResponse of(final PolicyId policyId, @Nullable final Policy policy, final DittoHeaders dittoHeaders) { return new CreatePolicyResponse(policyId, HttpStatusCode.CREATED, policy, dittoHeaders); } private  CreatePolicyResponse(final PolicyId policyId,
            final HttpStatusCode statusCode,
            @Nullable final Policy policyCreated,
            final DittoHeaders dittoHeaders); static CreatePolicyResponse of(final PolicyId policyId, @Nullable final Policy policy,
            final DittoHeaders dittoHeaders); @Deprecated static CreatePolicyResponse of(final String policyId, @Nullable final Policy policy,
            final DittoHeaders dittoHeaders); static CreatePolicyResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders); static CreatePolicyResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override PolicyId getEntityId(); Optional<Policy> getPolicyCreated(); @Override Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion); @Override JsonPointer getResourcePath(); @Override CreatePolicyResponse setDittoHeaders(final DittoHeaders dittoHeaders); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString(); static final String TYPE; }
@Test public void toJsonReturnsExpected() { final CreatePolicyResponse underTestCreated = CreatePolicyResponse.of(TestConstants.Policy.POLICY_ID, TestConstants.Policy.POLICY, TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJsonCreated = underTestCreated.toJson(FieldType.regularOrSpecial()); assertThat(actualJsonCreated).isEqualTo(KNOWN_JSON_CREATED); }