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

File DefaultWatchListStoreTest.java

 

Coverage histogram

../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

0
10
1
1
71
30
1
0.1
10
1
1

Classes

Class Line # Actions
DefaultWatchListStoreTest 39 10 0% 1 11
0.00%
 

Contributing tests

No tests hitting this source file were found.

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.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    * Unit tests for {@link org.xwiki.watchlist.internal.DefaultWatchListStore}.
35    *
36    * @version $Id: 37268e7f58bfcdb14c4f0018f7ad34b9857b105f $
37    * @since 5.3M1
38    */
 
39    public class DefaultWatchListStoreTest
40    {
41    private static final String TEST_USERDOC_NAME = "userspace.userpage";
42   
43    // common test objects: the watchlist, its user and a context to fetch the user from
44    private BaseObject watchListObject;
45   
46    private XWikiDocument userDocument;
47   
48    private XWikiContext xcontext;
49   
 
50  0 toggle @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    // Removed deprecated escaping tests from when the watched entities were stored in a string instead of a list.
70    // TODO: Add relevant tests.
71    }