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.spi.core.value;
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 java.util.List;
23  
24  import org.junit.Before;
25  import org.junit.Test;
26  
27  import de.smartics.properties.spi.core.value.CollectionPropertyValueRange;
28  import de.smartics.testdoc.annotations.Uut;
29  
30  /**
31   * Tests {@link CollectionPropertyValueRange} with arrays. Uses no element.
32   */
33  @Uut(type = CollectionPropertyValueRange.class)
34  public class CollectionPropertyValueRangeWithNoElementArrayTest
35  {
36    // ********************************* Fields *********************************
37  
38    // --- constants ------------------------------------------------------------
39  
40    // --- members --------------------------------------------------------------
41  
42    private CollectionPropertyValueRange<String> uut;
43  
44    // ****************************** Inner Classes *****************************
45  
46    // ********************************* Methods ********************************
47  
48    // --- prepare --------------------------------------------------------------
49  
50    @Before
51    public void setUp()
52    {
53      uut = new CollectionPropertyValueRange<String>(new String[0]);
54    }
55  
56    // --- helper ---------------------------------------------------------------
57  
58    // --- tests ----------------------------------------------------------------
59  
60    @Test
61    public void providesAStringRepresentation()
62    {
63      final String result = uut.toString();
64  
65      assertThat(result, is(equalTo("")));
66    }
67  
68    @Test(expected = IllegalArgumentException.class)
69    public void signalsRequestOfUnknownElementWithAnException()
70    {
71      final String elementName = "unknown-element-name";
72      uut.fromString(elementName);
73    }
74  
75    @Test
76    public void allowsToRetrieveAllValues()
77    {
78      final List<String> values = uut.getValues();
79  
80      assertThat(values.isEmpty(), is(true));
81    }
82  }