1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package test.de.smartics.properties.api.config.domain.key;
17
18 import static org.hamcrest.MatcherAssert.assertThat;
19 import static org.hamcrest.Matchers.equalTo;
20 import static org.hamcrest.Matchers.is;
21
22 import org.junit.Test;
23 import org.junit.experimental.categories.Category;
24
25 import de.smartics.properties.api.config.domain.key.ApplicationId;
26 import de.smartics.properties.api.config.domain.key.ConfigurationKey;
27 import de.smartics.properties.api.config.domain.key.EnvironmentId;
28 import de.smartics.testdoc.annotations.Uut;
29 import de.smartics.testdoc.categories.type.Construction;
30 import de.smartics.util.lang.NullArgumentException;
31
32
33
34
35 @Uut(type = ConfigurationKey.class)
36 @Category(Construction.class)
37 public class ConfigurationKeyConstructionTest
38 {
39
40 public static final EnvironmentId ENV_ID = new EnvironmentId("test2");
41
42 public static final ApplicationId APP_ID = new ApplicationId("group",
43 "artifactId", "1.0");
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 @Test
60 public void providesAccessToEnvironmentId()
61 {
62 final ConfigurationKey uut = new ConfigurationKey(ENV_ID, APP_ID);
63 assertThat(uut.getEnvironmentId(), is(equalTo(ENV_ID)));
64 }
65
66 @Test
67 public void providesAccessToApplicationId()
68 {
69 final ConfigurationKey uut = new ConfigurationKey(ENV_ID, APP_ID);
70 assertThat(uut.getApplicationId(), is(equalTo(APP_ID)));
71 }
72
73 @Test(expected = NullArgumentException.class)
74 public void requiresEnvironmentIdOnConstruction()
75 {
76 new ConfigurationKey(null, APP_ID);
77 }
78
79 @Test(expected = NullArgumentException.class)
80 public void requiresApplicationIdOnConstruction()
81 {
82 new ConfigurationKey(ENV_ID, null);
83 }
84
85
86
87 }