### Question:
PolicyEntryCreated extends AbstractPolicyEvent<PolicyEntryCreated> implements PolicyEvent<PolicyEntryCreated> { @Deprecated public static PolicyEntryCreated of(final String policyId, final PolicyEntry policyEntry, final long revision, final DittoHeaders dittoHeaders) { return of(PolicyId.of(policyId), policyEntry, revision, dittoHeaders); } private  PolicyEntryCreated(final PolicyId policyId,
            final PolicyEntry policyEntry,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders); @Deprecated static PolicyEntryCreated of(final String policyId,
            final PolicyEntry policyEntry,
            final long revision,
            final DittoHeaders dittoHeaders); static PolicyEntryCreated of(final PolicyId policyId,
            final PolicyEntry policyEntry,
            final long revision,
            final DittoHeaders dittoHeaders); @Deprecated static PolicyEntryCreated of(final String policyId,
            final PolicyEntry policyEntry,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders); static PolicyEntryCreated of(final PolicyId policyId,
            final PolicyEntry policyEntry,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders); static PolicyEntryCreated fromJson(final String jsonString, final DittoHeaders dittoHeaders); static PolicyEntryCreated fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); PolicyEntry getPolicyEntry(); @Override Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion); @Override JsonPointer getResourcePath(); @Override PolicyEntryCreated setRevision(final long revision); @Override PolicyEntryCreated setDittoHeaders(final DittoHeaders dittoHeaders); @SuppressWarnings("squid:S109") @Override int hashCode(); @SuppressWarnings("squid:MethodCyclomaticComplexity") @Override boolean equals(@Nullable final Object o); @Override String toString(); static final String NAME; static final String TYPE; static final JsonFieldDefinition<JsonObject> JSON_POLICY_ENTRY; }### Answer:
@Test(expected = PolicyIdInvalidException.class) public void tryToCreateInstanceWithNullPolicyIdString() { PolicyEntryCreated.of((String) null, TestConstants.Policy.POLICY_ENTRY, TestConstants.Policy.REVISION_NUMBER, TestConstants.EMPTY_DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullPolicyId() { PolicyEntryCreated.of((PolicyId) null, TestConstants.Policy.POLICY_ENTRY, TestConstants.Policy.REVISION_NUMBER, TestConstants.EMPTY_DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullPolicyEntry() { PolicyEntryCreated.of(TestConstants.Policy.POLICY_ID, null, TestConstants.Policy.REVISION_NUMBER, TestConstants.EMPTY_DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final PolicyEntryCreated underTest = PolicyEntryCreated.of(TestConstants.Policy.POLICY_ID, TestConstants.Policy.POLICY_ENTRY, TestConstants.Policy.REVISION_NUMBER, TestConstants.TIMESTAMP, TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }