DeletePolicy extends AbstractCommand<DeletePolicy> implements PolicyModifyCommand<DeletePolicy> { @Deprecated public static DeletePolicy of(final String policyId, final DittoHeaders dittoHeaders) { return of(PolicyId.of(policyId), dittoHeaders); } private  DeletePolicy(final PolicyId policyId, final DittoHeaders dittoHeaders); @Deprecated static DeletePolicy of(final String policyId, final DittoHeaders dittoHeaders); static DeletePolicy of(final PolicyId policyId, final DittoHeaders dittoHeaders); static DeletePolicy fromJson(final String jsonString, final DittoHeaders dittoHeaders); static DeletePolicy fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override PolicyId getEntityId(); @Override JsonPointer getResourcePath(); @Override Category getCategory(); @Override DeletePolicy setDittoHeaders(final DittoHeaders dittoHeaders); @SuppressWarnings("squid:MethodCyclomaticComplexity") @Override boolean equals(@Nullable final Object obj); @SuppressWarnings("squid:S109") @Override int hashCode(); @Override String toString(); static final String NAME; static final String TYPE; }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullPolicyId() { DeletePolicy.of((PolicyId) null, EMPTY_DITTO_HEADERS); }
@Test(expected = PolicyIdInvalidException.class) public void tryToCreateInstanceWithNullPolicyIdString() { DeletePolicy.of((String) null, EMPTY_DITTO_HEADERS); }
@Test public void tryToCreateInstanceWithInvalidPolicyId() { assertThatExceptionOfType(PolicyIdInvalidException.class) .isThrownBy(() -> DeletePolicy.of("undefined", EMPTY_DITTO_HEADERS)); }
@Test public void toJsonReturnsExpected() { final DeletePolicy underTest = DeletePolicy.of( TestConstants.Policy.POLICY_ID, EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }