View Javadoc

1   /*
2    * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package test.de.smartics.properties.api.config;
17  
18  import org.junit.experimental.categories.Category;
19  import org.junit.experimental.theories.DataPoint;
20  
21  import de.smartics.properties.api.config.domain.Property;
22  import de.smartics.properties.api.config.domain.PropertyLocation;
23  import de.smartics.testdoc.annotations.Uut;
24  import de.smartics.testdoc.categories.type.ObjectBasics;
25  import de.smartics.util.test.theories.ObjectTheories;
26  
27  /**
28   * Tests object basics of {@link Property}.
29   */
30  @Category(ObjectBasics.class)
31  @Uut(type = Property.class)
32  public class PropertyObjectTest extends ObjectTheories
33  {
34    private static final PropertyLocation SOURCE_ID =
35        new PropertyLocation("test");
36  
37    private static final String KEY_1 = "value1";
38  
39    private static final String VALUE_1 = "value1";
40  
41    private static final String KEY_2 = "key2";
42  
43    private static final String VALUE_2 = "value2";
44  
45    @DataPoint
46    public static final Property DEFAULT =
47        new Property(SOURCE_ID, KEY_1, VALUE_1); // NOPMD
48  
49    @DataPoint
50    public static final Property SAME = DEFAULT;
51  
52    @DataPoint
53    public static final Property EQUAL = new Property(SOURCE_ID, KEY_1, VALUE_1);
54  
55    @DataPoint
56    public static final Property OTHER_KEY = new Property(SOURCE_ID, KEY_2,
57        VALUE_1);
58  
59    @DataPoint
60    public static final Property OTHER_VALUE = new Property(SOURCE_ID, KEY_1,
61        VALUE_2);
62  
63    @DataPoint
64    public static final Property NULL_VALUE =
65        new Property(SOURCE_ID, KEY_1, null);
66  
67    @DataPoint
68    public static final String STRING = "OTHER_CLASS";
69  
70    @DataPoint
71    public static final Property NULL = null;
72  }