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 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 |
|
@link |
42 |
|
|
43 |
|
@version |
44 |
|
@since |
45 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 1 |
Complexity Density: 0.1 |
|
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 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
60 |
0 |
@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 |
|
|
86 |
|
} |