SudoRetrievePolicy extends AbstractCommand<SudoRetrievePolicy> implements SudoCommand<SudoRetrievePolicy> { public static SudoRetrievePolicy of(final PolicyId policyId, final DittoHeaders dittoHeaders) { return new SudoRetrievePolicy(policyId, dittoHeaders); } private  SudoRetrievePolicy(final PolicyId policyId, final DittoHeaders dittoHeaders); static SudoRetrievePolicy of(final PolicyId policyId, final DittoHeaders dittoHeaders); static SudoRetrievePolicy fromJson(final String jsonString, final DittoHeaders dittoHeaders); static SudoRetrievePolicy fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); @Override PolicyId getEntityId(); @Override Category getCategory(); @Override SudoRetrievePolicy setDittoHeaders(final DittoHeaders dittoHeaders); @SuppressWarnings({"squid:MethodCyclomaticComplexity", "squid:S1067"}) @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() { SudoRetrievePolicy.of(null, EMPTY_DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final SudoRetrievePolicy underTest = SudoRetrievePolicy.of(TestConstants.Policy.POLICY_ID, EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.REGULAR.or(FieldType.SPECIAL)); assertThat(actualJson).isEqualTo(KNOWN_JSON); }