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.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.ApplicationId;
25  import de.smartics.testdoc.annotations.Uut;
26  import de.smartics.testdoc.categories.type.Construction;
27  
28  /**
29   * Tests {@link ApplicationId}.
30   */
31  @Category(Construction.class)
32  @Uut(type = ApplicationId.class, method = "valueOf(String")
33  public class ApplicationIdValueOfTest
34  {
35  
36    // ********************************* Fields *********************************
37  
38    // --- constants ------------------------------------------------------------
39  
40    // --- members --------------------------------------------------------------
41  
42    // ****************************** Inner Classes *****************************
43  
44    // ********************************* Methods ********************************
45  
46    // --- prepare --------------------------------------------------------------
47  
48    // --- helper ---------------------------------------------------------------
49  
50    @Test
51    public void acceptNull()
52    {
53      final ApplicationId applicationId = ApplicationId.valueOf(null);
54      assertThat(applicationId.toString(), is("::"));
55    }
56  
57    @Test
58    public void canBeCreatedWithOnlyAnArtifactId()
59    {
60      final ApplicationId applicationId = ApplicationId.valueOf(":artifactId:");
61      assertThat(applicationId.toString(), is(":artifactId:"));
62    }
63  
64    @Test
65    public void canBeCreatedWithOnlyAGroupId()
66    {
67      final ApplicationId applicationId = ApplicationId.valueOf("groupId::");
68      assertThat(applicationId.toString(), is("groupId::"));
69    }
70  
71    @Test
72    public void canBeCreatedWithOnlyAVersion()
73    {
74      final ApplicationId applicationId = ApplicationId.valueOf("::version");
75      assertThat(applicationId.toString(), is("::version"));
76    }
77  
78    // --- tests ----------------------------------------------------------------
79  
80  }