1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.configuration;
19
20 import java.util.Properties;
21
22 import junit.framework.TestCase;
23
24 /***
25 * Tests for MapConfiguration.
26 *
27 * @author Emmanuel Bourg
28 * @version $Revision: 727834 $, $Date: 2008-12-18 23:16:32 +0100 (Do, 18 Dez 2008) $
29 */
30 public class TestSystemConfiguration extends TestCase
31 {
32 public void testSystemConfiguration()
33 {
34 Properties props = System.getProperties();
35 props.put("test.number", "123");
36
37 Configuration conf = new SystemConfiguration();
38 assertEquals("number", 123, conf.getInt("test.number"));
39 }
40
41 public void testSetSystemProperties()
42 {
43 PropertiesConfiguration props = new PropertiesConfiguration();
44 props.addProperty("test.name", "Apache");
45 SystemConfiguration conf = new SystemConfiguration();
46 conf.setSystemProperties(props);
47 assertEquals("System Properties", "Apache", System.getProperty("test.name"));
48 }
49 }