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.properties.impl.config.domain.key.envapp.EnvAppConfigurationKey;
29 import de.smartics.testdoc.annotations.Uut;
30 import de.smartics.testdoc.categories.type.Construction;
31 import de.smartics.util.lang.NullArgumentException;
32
33
34
35
36 @Uut(type = ConfigurationKey.class)
37 @Category(Construction.class)
38 public class ConfigurationKeyConstructionTest
39 {
40
41 public static final EnvironmentId ENV_ID = new EnvironmentId("test2");
42
43 public static final ApplicationId APP_ID = new ApplicationId("group",
44 "artifactId", "1.0");
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 @Test
61 public void providesAccessToEnvironmentId()
62 {
63 final EnvAppConfigurationKey uut = new EnvAppConfigurationKey(ENV_ID, APP_ID);
64 assertThat(uut.getEnvironmentId(), is(equalTo(ENV_ID)));
65 }
66
67 @Test
68 public void providesAccessToApplicationId()
69 {
70 final EnvAppConfigurationKey uut = new EnvAppConfigurationKey(ENV_ID, APP_ID);
71 assertThat(uut.getApplicationId(), is(equalTo(APP_ID)));
72 }
73
74 @Test(expected = NullArgumentException.class)
75 public void requiresEnvironmentIdOnConstruction()
76 {
77 new EnvAppConfigurationKey((EnvironmentId)null, APP_ID);
78 }
79
80 @Test(expected = NullArgumentException.class)
81 public void requiresApplicationIdOnConstruction()
82 {
83 new EnvAppConfigurationKey(ENV_ID, null);
84 }
85
86
87
88 }