ImmutablePolicy implements Policy { @Deprecated public static Policy of(@Nullable final String policyId, @Nullable final PolicyLifecycle lifecycle, @Nullable final PolicyRevision revision, @Nullable final Instant modified, @Nullable final Instant created, final Iterable<PolicyEntry> entries) { return of(PolicyId.of(policyId), lifecycle, revision, modified, created, entries); } private  ImmutablePolicy(@Nullable final PolicyId policyId,
            final Map<Label, PolicyEntry> theEntries,
            @Nullable final PolicyLifecycle lifecycle,
            @Nullable final PolicyRevision revision,
            @Nullable final Instant modified,
            @Nullable final Instant created); @Deprecated static Policy of(@Nullable final String policyId,
            @Nullable final PolicyLifecycle lifecycle,
            @Nullable final PolicyRevision revision,
            @Nullable final Instant modified,
            @Nullable final Instant created,
            final Iterable<PolicyEntry> entries); static Policy of(@Nullable final PolicyId policyId,
            @Nullable final PolicyLifecycle lifecycle,
            @Nullable final PolicyRevision revision,
            @Nullable final Instant modified,
            @Nullable final Instant created,
            final Iterable<PolicyEntry> entries); static Policy fromJson(final JsonObject jsonObject); @Override Optional<PolicyId> getEntityId(); @Override Optional<String> getNamespace(); @Override Optional<PolicyLifecycle> getLifecycle(); @Override Optional<PolicyRevision> getRevision(); @Override Optional<Instant> getModified(); @Override Optional<Instant> getCreated(); @Override Optional<Metadata> getMetadata(); @Override boolean isDeleted(); @Override Policy setEntry(final PolicyEntry policyEntry); @Override Set<Label> getLabels(); @Override boolean contains(final CharSequence label); @Override Optional<PolicyEntry> getEntryFor(final CharSequence label); @Override Policy removeEntry(final CharSequence label); @Override Policy removeEntry(final PolicyEntry entry); @Override Policy setSubjectsFor(final CharSequence label, final Subjects subjects); @Override Policy setSubjectFor(final CharSequence label, final Subject subject); @Override Policy removeSubjectFor(final CharSequence label, final SubjectId subjectId); @Override Policy setResourcesFor(final CharSequence label, final Resources resources); @Override Policy setResourceFor(final CharSequence label, final Resource resource); @Override Policy removeResourceFor(final CharSequence label, final ResourceKey resourceKey); @Override Optional<EffectedPermissions> getEffectedPermissionsFor(final CharSequence label, final SubjectId subjectId,
            final ResourceKey resourceKey); @Override boolean isEmpty(); @Override int getSize(); @Override Set<PolicyEntry> getEntriesSet(); @Override Stream<PolicyEntry> stream(); @Override Iterator<PolicyEntry> iterator(); @Override JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test(expected = PolicyIdInvalidException.class) public void testInvalidPolicyId() { ImmutablePolicy.of("foo bar", PolicyLifecycle.ACTIVE, PolicyRevision.newInstance(0), null, null, Collections.emptySet()); }
@Test(expected = PolicyIdInvalidException.class) public void testEmptyPolicyId() { ImmutablePolicy.of("", PolicyLifecycle.ACTIVE, PolicyRevision.newInstance(0), null, null, Collections.emptySet()); }