1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
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 |
|
@link |
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 2 |
Complexity Density: 0.18 |
|
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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
48 |
1 |
@Before... |
49 |
|
public void setUp() throws Exception |
50 |
|
{ |
51 |
1 |
objectReference = new ObjectReference(CLASS_REF.toString() + "[1]", DOC_REF); |
52 |
|
} |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1PASS
|
|
54 |
1 |
@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 |
|
} |