Debian Codegraph @

owner/src/test/java/org/aeonbits/owner/ConfigInheritanceTest.java

raw symbols SCIP
1 package org.aeonbits.owner;
2
3 import org.junit.Test;
4
5 import static org.junit.Assert.assertEquals;
6
7
8 /**
9 * Created by chengmingwang on 12/24/16.
10 */
11 public class ConfigInheritanceTest {
12 @Config.Sources(
13 {"classpath:test.properties","classpath:org/aeonbits/owner/first.properties"}
14 )
15 interface MyConfig extends Config {
16 @DefaultValue("favoriteColor")
17 String favoriteColor();
18 }
19
20 interface TheConfig1 extends MyConfig {
21
22 }
23
24 @Config.Sources(
25 {"classpath:org/aeonbits/owner/second.properties"}
26 )
27 interface TheConfig2 extends MyConfig {
28
29 }
30
31 @Config.Sources(
32 {"classpath:org/aeonbits/owner/second.properties"}
33 )
34 @Config.LoadPolicy(Config.LoadType.MERGE)
35 interface TheConfig3 extends MyConfig {
36
37 }
38
39 @Test
40 public void testSourcesInheritance() {
41 TheConfig1 theConfig1 = ConfigFactory.create(TheConfig1.class);
42 assertEquals("pink", theConfig1.favoriteColor());
43
44 TheConfig2 theConfig2 = ConfigFactory.create(TheConfig2.class);
45 assertEquals("favoriteColor", theConfig2.favoriteColor());
46
47 TheConfig3 theConfig3 = ConfigFactory.create(TheConfig3.class);
48 assertEquals("pink", theConfig3.favoriteColor());
49 }
50 }