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