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

File WikiUIExtensionTest.java

 

Code metrics

0
11
2
1
70
37
2
0.18
5.5
2
1

Classes

Class Line # Actions
WikiUIExtensionTest 38 11 0% 2 0
1.0100%
 

Contributing tests

This file is covered by 1 test. .

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.uiextension;
21   
22    import org.apache.commons.collections.MapUtils;
23    import org.junit.Assert;
24    import org.junit.Before;
25    import org.junit.Test;
26    import org.xwiki.component.wiki.WikiComponentScope;
27    import org.xwiki.model.reference.DocumentReference;
28    import org.xwiki.model.reference.ObjectReference;
29    import org.xwiki.rendering.block.WordBlock;
30    import org.xwiki.uiextension.internal.WikiUIExtension;
31   
32    /**
33    * Unit tests for {@link WikiUIExtension}.
34    *
35    * @version $Id: 6975a880d7ffb02306c9a7631c6dbe05b1d3c468 $
36    * @since 4.2M3
37    */
 
38    public class WikiUIExtensionTest
39    {
40    private static final DocumentReference CLASS_REF = new DocumentReference("xwiki", "XWiki", "UIExtensionClass");
41   
42    private static final DocumentReference DOC_REF = new DocumentReference("xwiki", "XWiki", "MyUIExtension");
43   
44    private static final DocumentReference AUTHOR_REFERENCE = new DocumentReference("xwiki", "XWiki", "Admin");
45   
46    private ObjectReference objectReference;
47   
 
48  1 toggle @Before
49    public void setUp() throws Exception
50    {
51  1 objectReference = new ObjectReference(CLASS_REF.toString() + "[1]", DOC_REF);
52    }
53   
 
54  1 toggle @Test
55    public void createWikiUIExtension()
56    {
57  1 WikiUIExtension wikiUIX =
58    new WikiUIExtension("roleHint", "id", "epId", objectReference, AUTHOR_REFERENCE, null);
59  1 wikiUIX.setScope(WikiComponentScope.WIKI);
60   
61  1 Assert.assertEquals("roleHint", wikiUIX.getRoleHint());
62  1 Assert.assertEquals("id", wikiUIX.getId());
63  1 Assert.assertEquals("epId", wikiUIX.getExtensionPointId());
64  1 Assert.assertEquals(AUTHOR_REFERENCE, wikiUIX.getAuthorReference());
65  1 Assert.assertEquals(UIExtension.class, wikiUIX.getRoleType());
66  1 Assert.assertEquals(WikiComponentScope.WIKI, wikiUIX.getScope());
67  1 Assert.assertEquals(new WordBlock(""), wikiUIX.execute());
68  1 Assert.assertEquals(MapUtils.EMPTY_MAP, wikiUIX.getParameters());
69    }
70    }