View Javadoc

1   /*
2    * Copyright 2012 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.ci.config.maven;
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.Before;
23  import org.junit.Test;
24  import org.junit.experimental.categories.Category;
25  
26  import de.smartics.ci.config.maven.MavenConfig;
27  import de.smartics.ci.config.maven.MavenPom;
28  import de.smartics.ci.config.maven.MavenSettings;
29  import de.smartics.testdoc.annotations.Uut;
30  import de.smartics.testdoc.categories.type.Construction;
31  import de.smartics.util.lang.NullArgumentException;
32  
33  /**
34   * Tests {@link MavenConfig}.
35   */
36  @Uut(type = MavenConfig.class)
37  @Category(Construction.class)
38  public class MavenConfigTest
39  {
40    // ********************************* Fields *********************************
41  
42    // --- constants ------------------------------------------------------------
43  
44    // --- members --------------------------------------------------------------
45  
46    private MavenPom mavenPom;
47  
48    private MavenSettings mavenSettings;
49  
50    // ****************************** Inner Classes *****************************
51  
52    // ********************************* Methods ********************************
53  
54    // --- prepare --------------------------------------------------------------
55  
56    @Before
57    public void setUp()
58    {
59      mavenPom = new MavenPom();
60      mavenSettings = new MavenSettings();
61    }
62  
63    // --- helper ---------------------------------------------------------------
64  
65    // --- tests ----------------------------------------------------------------
66  
67    @Test(expected = NullArgumentException.class)
68    public void requiresMavenSettingsOnConstruction()
69    {
70      new MavenConfig(null, mavenPom);
71    }
72  
73    @Test(expected = NullArgumentException.class)
74    public void requiresMavenPomOnConstruction()
75    {
76      new MavenConfig(mavenSettings, null);
77    }
78  
79    @Test
80    public void allowsToAccessAllProperties()
81    {
82      final MavenConfig uut = new MavenConfig(mavenSettings, mavenPom);
83  
84      assertThat(uut.getSettings(), is(equalTo(mavenSettings)));
85      assertThat(uut.getPom(), is(equalTo(mavenPom)));
86    }
87  }