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.core.domain;
17  
18  import static org.hamcrest.MatcherAssert.assertThat;
19  import static org.hamcrest.Matchers.is;
20  import static org.hamcrest.Matchers.nullValue;
21  
22  import org.junit.Before;
23  import org.junit.Test;
24  
25  import de.smartics.properties.api.core.domain.PropertiesContext;
26  import de.smartics.testdoc.annotations.Uut;
27  
28  /**
29   * Tests on an empty {@link PropertiesContext}.
30   */
31  public class PropertiesContextEmptyTest
32  {
33    // ********************************* Fields *********************************
34  
35    // --- constants ------------------------------------------------------------
36  
37    // --- members --------------------------------------------------------------
38  
39    @Uut
40    private PropertiesContext uut;
41  
42    // ****************************** Inner Classes *****************************
43  
44    // ********************************* Methods ********************************
45  
46    // --- prepare --------------------------------------------------------------
47  
48    @Before
49    public void setUp()
50    {
51      final PropertiesContext.Builder builder = new PropertiesContext.Builder();
52      uut = builder.build();
53    }
54  
55    // --- helper ---------------------------------------------------------------
56  
57    // --- tests ----------------------------------------------------------------
58  
59    @Test
60    public void returnsNullIfInformationIsMissing()
61    {
62      assertThat(uut.getHomePageUrl(), is(nullValue()));
63      assertThat(uut.getPropertiesReportUrl(), is(nullValue()));
64      assertThat(uut.getPropertiesReportIndexUrl(), is(nullValue()));
65    }
66  
67    @Test
68    public void returnsNullForReportUrlIfInformationIsMissing()
69    {
70      final String reportUrl = uut.createReportUrl("my-target");
71  
72      assertThat(reportUrl, is(nullValue()));
73    }
74  }