PolicyErrorResponse extends AbstractErrorResponse<PolicyErrorResponse> implements PolicyCommandResponse<PolicyErrorResponse> { public static PolicyErrorResponse of(final DittoRuntimeException dittoRuntimeException) { return of(FALLBACK_POLICY_ID, dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); } private  PolicyErrorResponse(final PolicyId policyId, final DittoRuntimeException dittoRuntimeException,
            final DittoHeaders dittoHeaders); static PolicyErrorResponse of(final DittoRuntimeException dittoRuntimeException); @Deprecated static PolicyErrorResponse of(final String policyId, final DittoRuntimeException dittoRuntimeException); static PolicyErrorResponse of(final PolicyId policyId, final DittoRuntimeException dittoRuntimeException); static PolicyErrorResponse of(final DittoRuntimeException dittoRuntimeException,
            final DittoHeaders dittoHeaders); @Deprecated static PolicyErrorResponse of(final String policyId, final DittoRuntimeException dittoRuntimeException,
            final DittoHeaders dittoHeaders); static PolicyErrorResponse of(final PolicyId policyId, final DittoRuntimeException dittoRuntimeException,
            final DittoHeaders dittoHeaders); static PolicyErrorResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders); static PolicyErrorResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override PolicyId getEntityId(); @Override DittoRuntimeException getDittoRuntimeException(); @Override JsonPointer getResourcePath(); @Override PolicyErrorResponse 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 PolicyErrorResponse underTest = PolicyErrorResponse.of(TestConstants.Policy.POLICY_ID, TestConstants.Policy.POLICY_NOT_ACCESSIBLE_EXCEPTION, TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJsonCreated = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJsonCreated).isEqualTo(KNOWN_JSON); }