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.resource.repository;
17  
18  import static org.hamcrest.MatcherAssert.assertThat;
19  import static org.hamcrest.Matchers.equalTo;
20  import static org.hamcrest.Matchers.is;
21  import static org.hamcrest.Matchers.nullValue;
22  
23  import org.junit.Test;
24  import org.junit.experimental.categories.Category;
25  
26  import de.smartics.properties.resource.domain.ArtifactId;
27  import de.smartics.testdoc.annotations.Uut;
28  import de.smartics.testdoc.categories.type.Coverage;
29  
30  /**
31   * Tests {@link ArtifactId}.
32   */
33  @Uut(type=ArtifactId.class)
34  @Category(Coverage.class)
35  public class ArtifactIdTest
36  {
37    //********************************* Fields *********************************
38  
39    // --- constants ------------------------------------------------------------
40  
41    private static final String GROUP_ID = "com.example.ones";
42  
43    private static final String ARTIFACT_ID = "artifact-one";
44  
45    private static final String VERSION = "1.0";
46  
47    private static final String ARCHIVE_TYPE = "jar";
48  
49    private static final String CLASSIFIER = "app";
50  
51    private static final String NO_CLASSIFIER = null;
52  
53    // --- members --------------------------------------------------------------
54  
55    // ****************************** Inner Classes *****************************
56  
57    // ********************************* Methods ********************************
58  
59    // --- prepare --------------------------------------------------------------
60  
61    // --- helper ---------------------------------------------------------------
62  
63    // --- tests ----------------------------------------------------------------
64  
65    @Test
66    public void getAndSet()
67    {
68      final ArtifactId uut = ArtifactId.create(GROUP_ID, ARTIFACT_ID, VERSION, ARCHIVE_TYPE, CLASSIFIER);
69  
70      assertThat(uut.getGroupId(), is(equalTo(GROUP_ID)));
71      assertThat(uut.getName(), is(equalTo(ARTIFACT_ID)));
72      assertThat(uut.getVersion(), is(equalTo(VERSION)));
73      assertThat(uut.getArchiveType(), is(equalTo(ARCHIVE_TYPE)));
74      assertThat(uut.getClassifier(), is(equalTo(CLASSIFIER)));
75    }
76  
77    @Test
78    public void getAndSetClassifierNull()
79    {
80      final ArtifactId uut = ArtifactId.create(GROUP_ID, ARTIFACT_ID, VERSION, ARCHIVE_TYPE, NO_CLASSIFIER);
81  
82      assertThat(uut.getGroupId(), is(equalTo(GROUP_ID)));
83      assertThat(uut.getName(), is(equalTo(ARTIFACT_ID)));
84      assertThat(uut.getVersion(), is(equalTo(VERSION)));
85      assertThat(uut.getArchiveType(), is(equalTo(ARCHIVE_TYPE)));
86      assertThat(uut.getClassifier(), is(nullValue()));
87    }
88  }