001/**
002 * Copyright 2010 The Kuali Foundation Licensed under the
003 * Educational Community License, Version 2.0 (the "License"); you may
004 * not use this file except in compliance with the License. You may
005 * obtain a copy of the License at
006 *
007 * http://www.osedu.org/licenses/ECL-2.0
008 *
009 * Unless required by applicable law or agreed to in writing,
010 * software distributed under the License is distributed on an "AS IS"
011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012 * or implied. See the License for the specific language governing
013 * permissions and limitations under the License.
014 */
015
016package org.kuali.student.common.util;
017
018import static org.junit.Assert.assertEquals;
019
020import org.junit.Test;
021import org.springframework.context.ApplicationContext;
022import org.springframework.context.support.ClassPathXmlApplicationContext;
023
024public class TestModPropertyPlaceholderConfigurer {
025
026        @Test
027        public void testSystemPropNestedResolution() {
028                System.setProperty("sys.username", "Bob ${sys.user.lastname}");
029                System.setProperty("sys.obit", "${sys.username} is dead.");
030                System.setProperty("otherproperties.filelocation", "test-modprop-otherproperties.properties");
031                ApplicationContext context = new ClassPathXmlApplicationContext("test-modprop-context.xml");
032                
033                String obit = (String)context.getBean("obit");
034                
035                assertEquals("I read that Bob Smith is dead.", obit);
036
037                String statement2 = (String)context.getBean("statement2");
038                
039                assertEquals("DOREMI", statement2);
040        }
041}