ImmutableEntityPlaceholder extends AbstractEntityPlaceholder<NamespacedEntityId> implements EntityPlaceholder { @Override public Optional<String> resolve(final CharSequence entityId, final String placeholder) { argumentNotEmpty(placeholder, "placeholder"); checkNotNull(entityId, "Entity ID"); try { final NamespacedEntityId namespacedEntityId = DefaultNamespacedEntityId.of(entityId); return doResolve(namespacedEntityId, placeholder); } catch (final NamespacedEntityIdInvalidException e) { return Optional.empty(); } }  @Override String getPrefix(); @Override Optional<String> resolve(final CharSequence entityId, final String placeholder);  }
@Test public void testReplacePolicyId() { assertThat(UNDER_TEST.resolve(POLICY_ID, "id")).contains(POLICY_ID.toString()); }
@Test public void testReplaceThingId() { assertThat(UNDER_TEST.resolve(THING_ID, "id")).contains(THING_ID.toString()); }
@Test public void testReplacePolicyName() { assertThat(UNDER_TEST.resolve(POLICY_ID, "name")).contains(NAME); }
@Test public void testReplaceThingName() { assertThat(UNDER_TEST.resolve(THING_ID, "name")).contains(NAME); }
@Test public void testReplacePolicyNamespace() { assertThat(UNDER_TEST.resolve(POLICY_ID, "namespace")).contains(NAMESPACE); }
@Test public void testReplaceThingNamespace() { assertThat(UNDER_TEST.resolve(THING_ID, "namespace")).contains(NAMESPACE); }
@Test public void testUnknownPlaceholderReturnsEmpty() { assertThat(UNDER_TEST.resolve(POLICY_ID, "policy_id")).isEmpty(); }