DeletePolicyEntry extends AbstractCommand<DeletePolicyEntry> implements PolicyModifyCommand<DeletePolicyEntry> { @Deprecated public static DeletePolicyEntry of(final String policyId, final Label label, final DittoHeaders dittoHeaders) { return of(PolicyId.of(policyId), label, dittoHeaders); } private  DeletePolicyEntry(final PolicyId policyId, final Label label, final DittoHeaders dittoHeaders); @Deprecated static DeletePolicyEntry of(final String policyId, final Label label, final DittoHeaders dittoHeaders); static DeletePolicyEntry of(final PolicyId policyId, final Label label, final DittoHeaders dittoHeaders); static DeletePolicyEntry fromJson(final String jsonString, final DittoHeaders dittoHeaders); static DeletePolicyEntry fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); Label getLabel(); @Override PolicyId getEntityId(); @Override JsonPointer getResourcePath(); @Override Category getCategory(); @Override DeletePolicyEntry 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() { DeletePolicyEntry.of((PolicyId) null, TestConstants.Policy.LABEL, TestConstants.EMPTY_DITTO_HEADERS); }
@Test(expected = PolicyIdInvalidException.class) public void tryToCreateInstanceWithNullPolicyIdString() { DeletePolicyEntry.of((String) null, TestConstants.Policy.LABEL, TestConstants.EMPTY_DITTO_HEADERS); }
@Test public void tryToCreateInstanceWithInvalidPolicyId() { assertThatExceptionOfType(PolicyIdInvalidException.class) .isThrownBy(() -> DeletePolicyEntry.of("undefined", TestConstants.Policy.LABEL, TestConstants.EMPTY_DITTO_HEADERS)); }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullLabel() { DeletePolicyEntry.of(TestConstants.Policy.POLICY_ID, null, TestConstants.EMPTY_DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final DeletePolicyEntry underTest = DeletePolicyEntry.of( TestConstants.Policy.POLICY_ID, TestConstants.Policy.LABEL, TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }