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

File DefaultWatchListNotifierTest.java

 

Coverage histogram

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

Code metrics

0
10
1
1
86
42
1
0.1
10
1
1

Classes

Class Line # Actions
DefaultWatchListNotifierTest 46 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 javax.inject.Provider;
23   
24    import org.junit.Before;
25    import org.junit.Rule;
26    import org.xwiki.mail.MailSender;
27    import org.xwiki.model.reference.DocumentReferenceResolver;
28    import org.xwiki.model.reference.EntityReferenceSerializer;
29    import org.xwiki.test.mockito.MockitoComponentMockingRule;
30    import org.xwiki.watchlist.internal.api.WatchListNotifier;
31   
32    import com.xpn.xwiki.XWiki;
33    import com.xpn.xwiki.XWikiContext;
34    import com.xpn.xwiki.objects.BaseObject;
35    import com.xpn.xwiki.web.Utils;
36   
37    import static org.mockito.Mockito.mock;
38    import static org.mockito.Mockito.when;
39   
40    /**
41    * Unit tests for {@link org.xwiki.watchlist.internal.DefaultWatchListNotifier}.
42    *
43    * @version $Id: 46c2faada662bc0e5357a5f23887539200f0212a $
44    * @since 5.0M2
45    */
 
46    public class DefaultWatchListNotifierTest
47    {
48    private XWikiContext xcontext;
49   
50    private XWiki xwiki;
51   
52    private BaseObject userObject;
53   
54    private MailSender mockMailSender;
55   
56    @Rule
57    public MockitoComponentMockingRule<WatchListNotifier> mocker = new MockitoComponentMockingRule<WatchListNotifier>(
58    DefaultWatchListNotifier.class);
59   
 
60  0 toggle @Before
61    public void setUp() throws Exception
62    {
63  0 this.xcontext = mock(XWikiContext.class);
64   
65  0 Provider<XWikiContext> contextProvider = mocker.getInstance(XWikiContext.TYPE_PROVIDER);
66  0 when(contextProvider.get()).thenReturn(this.xcontext);
67   
68  0 this.xwiki = mock(com.xpn.xwiki.XWiki.class);
69  0 when(this.xcontext.getWiki()).thenReturn(this.xwiki);
70   
71  0 DocumentReferenceResolver<String> defaultDocumentReferenceResolver =
72    mocker.registerMockComponent(DocumentReferenceResolver.TYPE_STRING);
73   
74  0 DocumentReferenceResolver<String> currentmixedResolver =
75    mocker.registerMockComponent(DocumentReferenceResolver.TYPE_STRING, "currentmixed");
76   
77  0 EntityReferenceSerializer<String> defaultStringEntityReferenceSerializer =
78    mocker.registerMockComponent(EntityReferenceSerializer.TYPE_STRING);
79   
80  0 Utils.setComponentManager(mocker);
81   
82  0 mockMailSender = mocker.getInstance(MailSender.class);
83    }
84   
85    // TODO: Add tests since we changed the logic of DefaultWatchListNotifier and it now only delegates.
86    }