PentahoPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { @Override protected String resolvePlaceholder( String placeholder, Properties props ) { String val = this.resolveValue( placeholder ); if ( val == null ) { val = super.resolvePlaceholder( placeholder, props ); } return val; } PentahoPropertyPlaceholderConfigurer( ISystemConfig config );   }
@Test public void testResolvePlaceholder() throws Exception { when( systemConfig.getProperty( "prop" ) ).thenReturn( "val" ); configurer = new PentahoPropertyPlaceholderConfigurer( systemConfig ); String prop = configurer.resolvePlaceholder( "prop", null ); assertEquals( prop, "val" ); }
@Test public void testResolvePlaceholder_fallback() throws Exception { when( systemConfig.getProperty( "prop" ) ).thenReturn( null ); configurer = spy( new PentahoPropertyPlaceholderConfigurer( systemConfig ) ); Properties properties = mock( Properties.class ); when( properties.getProperty( "prop" ) ).thenReturn( "fallbackValue" ); String prop = configurer.resolvePlaceholder( "prop", properties ); assertEquals( prop, "fallbackValue" ); }