PlaceholderResolved { public String getResolvePlaceholderText(final String text) { if (placeholderMap.isEmpty()) { return text; } IllegalArgumentException missingException = null; for (Entry<String, PropertySourcesPlaceholderConfigurer> entry : placeholderMap.entrySet()) { PropertySourcesPropertyResolver propertyResolver; try { propertyResolver = new PropertySourcesPropertyResolver(entry.getValue().getAppliedPropertySources()); } catch (final IllegalStateException ex) { continue; } catch (final NoSuchMethodError ex) { try { propertyResolver = getPropertyResolverBeforeSpring4(entry.getValue()); } catch (final ReflectiveOperationException e) { log.warn("Cannot get placeholder resolver."); return text; } } try { return propertyResolver.resolveRequiredPlaceholders(text); } catch (final IllegalArgumentException ex) { missingException = ex; } } if (null == missingException) { return text; } throw missingException; } PlaceholderResolved(final ListableBeanFactory beanFactory); String getResolvePlaceholderText(final String text);  }
@Test public void assertExistedPlaceHolder() { assertThat(placeholderResolved.getResolvePlaceholderText("${withNamespace_1}"), is("with_namespace_value_1")); assertThat(placeholderResolved.getResolvePlaceholderText("${withNamespace_2}"), is("with_namespace_value_2")); }
@Test public void assertNoPlaceHolder() { assertThat(placeholderResolved.getResolvePlaceholderText("placeholder"), is("placeholder")); }
@Test(expected = IllegalArgumentException.class) public void assertNotExistedPlaceHolder() { placeholderResolved.getResolvePlaceholderText("${withNamespace_3}"); }