1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.watchlist.internal; |
21 |
|
|
22 |
|
import static org.mockito.ArgumentMatchers.any; |
23 |
|
import static org.mockito.ArgumentMatchers.eq; |
24 |
|
import static org.mockito.Mockito.mock; |
25 |
|
import static org.mockito.Mockito.when; |
26 |
|
|
27 |
|
import org.junit.Before; |
28 |
|
|
29 |
|
import com.xpn.xwiki.XWikiContext; |
30 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
31 |
|
import com.xpn.xwiki.objects.BaseObject; |
32 |
|
|
33 |
|
|
34 |
|
@link |
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 1 |
Complexity Density: 0.1 |
|
39 |
|
public class DefaultWatchListStoreTest |
40 |
|
{ |
41 |
|
private static final String TEST_USERDOC_NAME = "userspace.userpage"; |
42 |
|
|
43 |
|
|
44 |
|
private BaseObject watchListObject; |
45 |
|
|
46 |
|
private XWikiDocument userDocument; |
47 |
|
|
48 |
|
private XWikiContext xcontext; |
49 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
50 |
0 |
@Before... |
51 |
|
public void setUpUserWithWatchList() throws Exception |
52 |
|
{ |
53 |
0 |
watchListObject = mock(BaseObject.class); |
54 |
|
|
55 |
0 |
userDocument = mock(XWikiDocument.class); |
56 |
0 |
when(userDocument.isNew()).thenReturn(false); |
57 |
0 |
when(userDocument.getObject("XWiki.XWikiUsers")).thenReturn(mock(BaseObject.class)); |
58 |
0 |
when(userDocument.getObject("XWiki.WatchListClass")).thenReturn(watchListObject); |
59 |
|
|
60 |
0 |
com.xpn.xwiki.XWiki xwiki = mock(com.xpn.xwiki.XWiki.class); |
61 |
0 |
when(xwiki.getDocument(eq(TEST_USERDOC_NAME), any(XWikiContext.class))).thenReturn(userDocument); |
62 |
|
|
63 |
0 |
xcontext = mock(XWikiContext.class); |
64 |
0 |
when(xcontext.getWiki()).thenReturn(xwiki); |
65 |
0 |
when(xcontext.getWikiId()).thenReturn("wiki"); |
66 |
|
|
67 |
|
} |
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
} |