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

File WikiMacroDescriptorTest.java

 

Code metrics

0
6
1
1
59
24
1
0.17
6
1
1

Classes

Class Line # Actions
WikiMacroDescriptorTest 38 6 0% 1 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.rendering.macro.wikibridge;
21   
22    import java.util.Arrays;
23    import java.util.Iterator;
24    import java.util.List;
25    import java.util.Map;
26   
27    import org.junit.Assert;
28   
29    import org.xwiki.rendering.macro.descriptor.DefaultContentDescriptor;
30    import org.xwiki.rendering.macro.descriptor.ParameterDescriptor;
31   
32    /**
33    * Unit test for {@link WikiMacroDescriptor}.
34    *
35    * @version $Id: 1dcdd4ce71f18ca36400318e8cd46e8d9fec7634 $
36    * @since 2.1RC1
37    */
 
38    public class WikiMacroDescriptorTest
39    {
40    /**
41    * Ensure that the parameter descriptor map returned has the same order as the order in which parameter
42    * descriptors are passed to the Wiki Macro descriptor. This is useful for example to ensure that the
43    * WYSIWYG editor will display the wiki macro parameter in the same order as the Wiki Macro Object order.
44    */
 
45  1 toggle @org.junit.Test
46    public void testGetParameterDescriptorMapInCorrectOrder()
47    {
48  1 List<WikiMacroParameterDescriptor> paramDescriptors = Arrays.asList(
49    new WikiMacroParameterDescriptor("id1", "description1", true),
50    new WikiMacroParameterDescriptor("id2", "description2", true));
51  1 WikiMacroDescriptor descriptor = new WikiMacroDescriptor("name", "description", "category",
52    WikiMacroVisibility.GLOBAL, new DefaultContentDescriptor(), paramDescriptors);
53  1 Map<String, ParameterDescriptor> result = descriptor.getParameterDescriptorMap();
54   
55  1 Iterator<String> it = result.keySet().iterator();
56  1 Assert.assertEquals("id1", it.next());
57  1 Assert.assertEquals("id2", it.next());
58    }
59    }