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