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 import static org.hamcrest.Matchers.nullValue;
22
23 import org.junit.Test;
24 import org.junit.experimental.categories.Category;
25
26 import de.smartics.properties.api.config.domain.key.EnvironmentId;
27 import de.smartics.testdoc.annotations.Uut;
28 import de.smartics.testdoc.categories.type.Construction;
29
30
31
32
33 @Uut(type = EnvironmentId.class)
34 @Category(Construction.class)
35 public class EnvironmentIdConstructionTest
36 {
37
38 private static final String NAME = "name";
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 @Test
55 public void providesAccessToEnvironmentName()
56 {
57 final EnvironmentId uut = new EnvironmentId(NAME);
58 assertThat(uut.getName(), is(equalTo(NAME)));
59 }
60
61 @Test
62 public void noRequiredNameOnConstruction()
63 {
64 final EnvironmentId uut = new EnvironmentId(null);
65 assertThat(uut.getName(), is(nullValue()));
66 }
67
68 @Test(expected = IllegalArgumentException.class)
69 public void nameMustNotBeEmpty()
70 {
71 new EnvironmentId("");
72 }
73
74 @Test(expected = IllegalArgumentException.class)
75 public void nameMustNotContainOnlyWhiteSpaces()
76 {
77 new EnvironmentId(" ");
78 }
79
80
81
82 }