1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package de.smartics.properties.impl.config.domain.key.rtaware;
17
18 import static org.hamcrest.MatcherAssert.assertThat;
19 import static org.hamcrest.Matchers.is;
20
21 import java.util.List;
22
23 import org.junit.Before;
24 import org.junit.Test;
25
26 import de.smartics.properties.api.config.domain.key.ConfigurationKey;
27 import de.smartics.testdoc.annotations.Uut;
28
29 public class TenantUserKeyListBuilderTest
30 {
31
32 @Uut
33 private TenantUserKeyListBuilder uut;
34
35 private TenantUserConfigurationKeyFactory keyFactory;
36
37 private ConfigurationKey<?> key;
38
39 @Before
40 public void setUp() throws Exception
41 {
42 this.uut = new TenantUserKeyListBuilder();
43 this.keyFactory = new TenantUserConfigurationKeyFactory();
44 this.key =
45 keyFactory
46 .createKeyFromString("user/tenant/environment:node/groupId:artifactid:version");
47 }
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69 @Test
70 public void returnsStrictlyDefindedKeys()
71 {
72 final List<ConfigurationKey<?>> keyList = uut.createKeyList(key);
73 final String expected =
74 "[user/tenant/environment:node/groupId:artifactid:version,"
75 + " user//:/::, /tenant/:/::, //environment:node/groupId:artifactid:,"
76 + " //environment:node/groupId::, //environment:node/::,"
77 + " //environment:/groupId:artifactid:version,"
78 + " //environment:/groupId:artifactid:, //environment:/groupId::,"
79 + " //environment:/::, //:/groupId:artifactid:version,"
80 + " //:/groupId:artifactid:, //:/groupId::, //:/::]";
81 assertThat(keyList.toString(), is(expected));
82
83 }
84
85 }