1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.doc; |
21 |
|
|
22 |
|
import org.jmock.Mock; |
23 |
|
import org.xwiki.bridge.DocumentAccessBridge; |
24 |
|
import org.xwiki.model.reference.DocumentReference; |
25 |
|
|
26 |
|
import com.xpn.xwiki.XWiki; |
27 |
|
import com.xpn.xwiki.test.AbstractBridgedXWikiComponentTestCase; |
28 |
|
import com.xpn.xwiki.web.XWikiURLFactory; |
29 |
|
|
30 |
|
|
31 |
|
@link |
32 |
|
|
33 |
|
@version |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
35 |
|
public class DefaultDocumentAccessBridgeTest extends AbstractBridgedXWikiComponentTestCase |
36 |
|
{ |
37 |
|
private DocumentAccessBridge documentAccessBridge; |
38 |
|
|
39 |
|
private Mock mockXWiki; |
40 |
|
|
41 |
|
private Mock mockURLFactory; |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
43 |
1 |
@Override... |
44 |
|
protected void setUp() throws Exception |
45 |
|
{ |
46 |
1 |
super.setUp(); |
47 |
|
|
48 |
1 |
this.mockXWiki = mock(XWiki.class); |
49 |
1 |
this.mockURLFactory = mock(XWikiURLFactory.class); |
50 |
|
|
51 |
1 |
getContext().setURLFactory((XWikiURLFactory) mockURLFactory.proxy()); |
52 |
1 |
getContext().setWiki((XWiki) mockXWiki.proxy()); |
53 |
|
|
54 |
1 |
this.documentAccessBridge = getComponentManager().getInstance(DocumentAccessBridge.class); |
55 |
|
} |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
57 |
1 |
public void testGetUrlEmptyDocument()... |
58 |
|
{ |
59 |
1 |
getContext().setDoc(new XWikiDocument(new DocumentReference("Wiki", "Space", "Page"))); |
60 |
1 |
this.mockXWiki.stubs().method("getURL").will(returnValue("/xwiki/bin/view/Main/WebHome")); |
61 |
|
|
62 |
1 |
assertEquals("/xwiki/bin/view/Main/WebHome", this.documentAccessBridge.getURL("", "view", "", "")); |
63 |
1 |
assertEquals("/xwiki/bin/view/Main/WebHome", this.documentAccessBridge.getURL(null, "view", "", "")); |
64 |
|
} |
65 |
|
} |