1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.url.internal.standard

File DefaultStandardURLConfigurationTest.java

 

Code metrics

0
12
4
1
76
40
4
0.33
3
4
1

Classes

Class Line # Actions
DefaultStandardURLConfigurationTest 35 12 0% 4 0
1.0100%
 

Contributing tests

This file is covered by 4 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.url.internal.standard;
21   
22    import org.junit.*;
23    import org.xwiki.configuration.ConfigurationSource;
24    import org.xwiki.test.mockito.MockitoComponentMockingRule;
25   
26    import static org.junit.Assert.*;
27    import static org.mockito.Mockito.*;
28   
29    /**
30    * Unit tests for {@link DefaultStandardURLConfiguration}.
31    *
32    * @version $Id: 2b17283c2592cbecadf7033190d3833f4c785cd4 $
33    * @since 5.3M1
34    */
 
35    public class DefaultStandardURLConfigurationTest
36    {
37    @Rule
38    public MockitoComponentMockingRule<DefaultStandardURLConfiguration> mocker =
39    new MockitoComponentMockingRule<>(DefaultStandardURLConfiguration.class);
40   
 
41  1 toggle @Test
42    public void isPathBasedMultiWiki() throws Exception
43    {
44  1 ConfigurationSource source = this.mocker.getInstance(ConfigurationSource.class, "xwikiproperties");
45  1 when(source.getProperty("url.standard.multiwiki.isPathBased", Boolean.TRUE)).thenReturn(Boolean.TRUE);
46   
47  1 assertTrue(this.mocker.getComponentUnderTest().isPathBasedMultiWiki());
48    }
49   
 
50  1 toggle @Test
51    public void getWikiPathPrefix() throws Exception
52    {
53  1 ConfigurationSource source = this.mocker.getInstance(ConfigurationSource.class, "xwikiproperties");
54  1 when(source.getProperty("url.standard.multiwiki.wikiPathPrefix", "wiki")).thenReturn("wiki");
55   
56  1 assertEquals("wiki", this.mocker.getComponentUnderTest().getWikiPathPrefix());
57    }
58   
 
59  1 toggle @Test
60    public void getEntityPathPrefix() throws Exception
61    {
62  1 ConfigurationSource source = this.mocker.getInstance(ConfigurationSource.class, "xwikiproperties");
63  1 when(source.getProperty("url.standard.entityPathPrefix", "bin")).thenReturn("bin");
64   
65  1 assertEquals("bin", this.mocker.getComponentUnderTest().getEntityPathPrefix());
66    }
67   
 
68  1 toggle @Test
69    public void isViewActionHidden() throws Exception
70    {
71  1 ConfigurationSource source = this.mocker.getInstance(ConfigurationSource.class, "xwikiproperties");
72  1 when(source.getProperty("url.standard.hideViewAction", false)).thenReturn(false);
73   
74  1 assertFalse(this.mocker.getComponentUnderTest().isViewActionHidden());
75    }
76    }