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.is;
20
21 import org.junit.Test;
22 import org.junit.experimental.categories.Category;
23
24 import de.smartics.properties.api.config.domain.key.EnvironmentId;
25 import de.smartics.testdoc.annotations.Uut;
26 import de.smartics.testdoc.categories.type.Construction;
27
28
29
30
31 @Category(Construction.class)
32 @Uut(type = EnvironmentId.class, method = "valueOf(String")
33 public class EnvironmentIdValueOfTest
34 {
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 @Test
51 public void acceptNull()
52 {
53 final EnvironmentId environmentId = EnvironmentId.valueOf(null);
54 assertThat(environmentId.toString(), is(":"));
55 }
56
57 @Test
58 public void canBeCreatedWithOnlyAnEnvironmentName()
59 {
60 final EnvironmentId environmentId = EnvironmentId.valueOf("name");
61 assertThat(environmentId.toString(), is("name:"));
62 }
63
64 @Test
65 public void canBeCreatedWithEnvironmentNameAndNodeName()
66 {
67 final EnvironmentId environmentId = EnvironmentId.valueOf("name:node");
68 assertThat(environmentId.toString(), is("name:node"));
69 }
70
71 @Test
72 public void canBeCreatedWithOnlyANodeName()
73 {
74 final EnvironmentId environmentId = EnvironmentId.valueOf(":node");
75 assertThat(environmentId.toString(), is(":node"));
76 }
77
78
79
80 }