1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package test.de.smartics.properties.api.config;
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.Property;
26 import de.smartics.properties.api.config.domain.PropertyLocation;
27 import de.smartics.testdoc.annotations.Uut;
28 import de.smartics.testdoc.categories.type.Construction;
29
30
31
32
33 @Uut(type = Property.class)
34 @Category(Construction.class)
35 public class PropertyConstructionTest
36 {
37
38
39
40
41 private static final PropertyLocation SOURCE_ID =
42 new PropertyLocation("test");
43
44 private static final String NAME = "name";
45
46 private static final String VALUE = "value";
47
48
49
50
51
52
53
54
55
56
57
58
59
60 @Test
61 public void allowsValueOfNull()
62 {
63 new Property(SOURCE_ID, NAME, null);
64 }
65
66 @Test(expected = NullPointerException.class)
67 public void requiresNameToBeNotNull()
68 {
69 new Property(SOURCE_ID, null, VALUE);
70 }
71
72 @Test
73 public void providesAccessToPropertyName()
74 {
75 final Property uut = new Property(SOURCE_ID, NAME, VALUE);
76 assertThat(uut.getName(), is(equalTo(NAME)));
77 }
78
79 @Test
80 public void providesAccessToPropertyValue()
81 {
82 final Property uut = new Property(SOURCE_ID, NAME, VALUE);
83 assertThat(uut.getValue(), is(equalTo(VALUE)));
84 }
85 }