View Javadoc
1   package org.kuali.common.util.properties;
2   
3   import java.util.Properties;
4   
5   import org.junit.Test;
6   import org.kuali.common.util.PropertyUtils;
7   import org.springframework.util.PropertyPlaceholderHelper;
8   
9   public class RicePropertiesLoaderTest {
10  
11  	@Test
12  	public void test() {
13  		try {
14  			System.setProperty("milk.price", "4.44");
15  			System.setProperty("foo", "${bar}");
16  			String location = "classpath:org/kuali/common/kuali-util/properties/breakfast.xml";
17  			PropertyPlaceholderHelper helper = RicePropertyPlaceholderHelper.builder().allowUnresolvablePlaceholders(true).build();
18  			RicePropertiesLoader loader = RicePropertiesLoader.builder().systemPropertiesWin(false).propertyPlaceholderHelper(helper).build();
19  			Properties properties = loader.load(location);
20  			PropertyUtils.info(properties);
21  		} catch (Exception e) {
22  			e.printStackTrace();
23  		}
24  	}
25  
26  }