### Question:
JndiAwarePropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { @Override protected String resolvePlaceholder(String placeholder, Properties props, int systemPropertiesMode) { String propValue = resolveJndiPropertyAndLog(placeholder); if (propValue == null) { propValue = super.resolvePlaceholder(placeholder, props, systemPropertiesMode); } return propValue; }  static String resolveJndiProperty(String placeholder);  }### Answer:
@Test public void shouldLookForPropertyInJndi() throws Exception { givenTomcatContextWithProps("placeholder", "jndi"); assertEquals(sut.resolvePlaceholder("placeholder", null, 0), "jndi"); }
@Test public void shouldNotLookInOtherPlacesIfFoundInJndi() throws Exception { String propName = "JndiAwarePropertyPlaceholderConfigurerTest-TestPlaceholder1"; Properties properties = new Properties(); properties.put(propName, "properties"); System.setProperty(propName, "system"); givenTomcatContextWithProps(propName, "jndi"); assertEquals(sut.resolvePlaceholder(propName, properties, 0), "jndi"); }
@Test public void looksInUsualPropertiesIfNotFoundInJndi() throws Exception { String propName = "JndiAwarePropertyPlaceholderConfigurerTest-TestPlaceholder2"; Properties properties = new Properties(); properties.put(propName, "properties"); assertEquals(sut.resolvePlaceholder(propName, properties, 0), "properties"); }