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.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.key.ApplicationId;
26  import de.smartics.testdoc.annotations.Uut;
27  import de.smartics.testdoc.categories.type.Construction;
28  
29  /**
30   * Tests {@link ApplicationId}.
31   */
32  @Uut(type = ApplicationId.class)
33  @Category(Construction.class)
34  public class ApplicationIdConstructionTest
35  {
36    private static final String GROUP_ID = "group";
37  
38    private static final String VERSION = "1.0";
39  
40    private static final String ARTIFACT_ID = "artifactId";
41  
42    // ********************************* Fields *********************************
43  
44    // --- constants ------------------------------------------------------------
45  
46    // --- members --------------------------------------------------------------
47  
48    // ****************************** Inner Classes *****************************
49  
50    // ********************************* Methods ********************************
51  
52    // --- prepare --------------------------------------------------------------
53  
54    // --- helper ---------------------------------------------------------------
55  
56    @Test
57    public void providesAccessToGroupId()
58    {
59      final ApplicationId uut = new ApplicationId(GROUP_ID, ARTIFACT_ID, VERSION);
60      assertThat(uut.getGroupId(), is(equalTo(GROUP_ID)));
61    }
62  
63    @Test
64    public void providesAccessToArtifactId()
65    {
66      final ApplicationId uut = new ApplicationId(GROUP_ID, ARTIFACT_ID, VERSION);
67      assertThat(uut.getArtifactId(), is(equalTo(ARTIFACT_ID)));
68    }
69  
70    @Test
71    public void providesAccessToVersion()
72    {
73      final ApplicationId uut = new ApplicationId(GROUP_ID, ARTIFACT_ID, VERSION);
74      assertThat(uut.getVersion(), is(equalTo(VERSION)));
75    }
76  
77    @Test
78    public void versionNotRequiredOnConstruction()
79    {
80      new ApplicationId(GROUP_ID, ARTIFACT_ID, null);
81    }
82  
83    @Test
84    public void groupIdNotRequiredOnConstruction()
85    {
86      new ApplicationId(null, null, null);
87    }
88  
89    @Test
90    public void artifactIdNotRequiredOnConstruction()
91    {
92      new ApplicationId(GROUP_ID, null, null);
93    }
94  
95    // --- tests ----------------------------------------------------------------
96  
97  }