|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| package org.jconfig; |
|
7 |
| |
|
8 |
| import junit.framework.TestCase; |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| public class ExtensibleConfigurationTest extends TestCase { |
|
16 |
| |
|
17 |
| private Configuration cfg; |
|
18 |
0
| public ExtensibleConfigurationTest(String name) {
|
|
19 |
0
| super(name);
|
|
20 |
| } |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
0
| public static void main(String[] args) {
|
|
27 |
0
| junit.textui.TestRunner.run(ExtensibleConfigurationTest.class);
|
|
28 |
| } |
|
29 |
| |
|
30 |
0
| protected void setUp() {
|
|
31 |
0
| cfg = new ExtensibleConfiguration("Test");
|
|
32 |
0
| assertNotNull(cfg);
|
|
33 |
| } |
|
34 |
| |
|
35 |
0
| protected void tearDown() {
|
|
36 |
| } |
|
37 |
| |
|
38 |
0
| public void testInheritance() {
|
|
39 |
0
| Category cat1 = new DefaultCategory("cat1");
|
|
40 |
0
| cfg.setCategory(cat1);
|
|
41 |
0
| cfg.setProperty("hello","world","cat1");
|
|
42 |
0
| Category cat2 = new DefaultCategory("cat2");
|
|
43 |
0
| cat2.setExtendsCategory("cat1");
|
|
44 |
0
| cfg.setCategory(cat2);
|
|
45 |
0
| String val = cfg.getProperty("hello",null,"cat2");
|
|
46 |
0
| assertEquals("world",val);
|
|
47 |
0
| val = cfg.getProperty("hello2",null,"cat2");
|
|
48 |
0
| assertEquals(null,val);
|
|
49 |
| } |
|
50 |
| } |