PolicyModified extends AbstractPolicyEvent<PolicyModified> implements PolicyEvent<PolicyModified> { public static PolicyModified of(final Policy policy, final long revision, final DittoHeaders dittoHeaders) { return of(policy, revision, null, dittoHeaders); } private  PolicyModified(final Policy policy,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders); static PolicyModified of(final Policy policy, final long revision, final DittoHeaders dittoHeaders); static PolicyModified of(final Policy policy,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders); static PolicyModified fromJson(final String jsonString, final DittoHeaders dittoHeaders); static PolicyModified fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); Policy getPolicy(); @Override Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion); @Override JsonPointer getResourcePath(); @Override PolicyModified setRevision(final long revision); @Override PolicyModified 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; }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullPolicy() { PolicyModified.of(null, TestConstants.Policy.REVISION_NUMBER, TestConstants.EMPTY_DITTO_HEADERS); }
@Test(expected = PolicyIdInvalidException.class) public void tryToCreateInstanceWithNullPolicyId() { final Policy policyWithNullId = PoliciesModelFactory.newPolicyBuilder((String) null).build(); PolicyModified.of(policyWithNullId, 0, TestConstants.EMPTY_DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final PolicyModified underTest = PolicyModified.of(TestConstants.Policy.POLICY, TestConstants.Policy.REVISION_NUMBER, TestConstants.TIMESTAMP, TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }