1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.mail.internal; |
21 |
|
|
22 |
|
import org.junit.Rule; |
23 |
|
import org.junit.Test; |
24 |
|
import org.xwiki.configuration.ConfigurationSource; |
25 |
|
import org.xwiki.test.mockito.MockitoComponentMockingRule; |
26 |
|
|
27 |
|
import static org.junit.Assert.assertEquals; |
28 |
|
import static org.mockito.Mockito.when; |
29 |
|
|
30 |
|
|
31 |
|
@link |
32 |
|
|
33 |
|
@version |
34 |
|
@since |
35 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
36 |
|
public class DefaultMailStorageConfigurationTest |
37 |
|
{ |
38 |
|
@Rule |
39 |
|
public MockitoComponentMockingRule<DefaultMailStorageConfiguration> mocker = |
40 |
|
new MockitoComponentMockingRule<>(DefaultMailStorageConfiguration.class); |
41 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
42 |
1 |
@Test... |
43 |
|
public void discardSuccessStatusesWhenNotDefined() throws Exception |
44 |
|
{ |
45 |
1 |
ConfigurationSource xwikiPropertiesSource = |
46 |
|
this.mocker.getInstance(ConfigurationSource.class, "xwikiproperties"); |
47 |
1 |
when(xwikiPropertiesSource.getProperty("mail.sender.database.discardSuccessStatuses", 1)).thenReturn(1); |
48 |
|
|
49 |
1 |
assertEquals(true, this.mocker.getComponentUnderTest().discardSuccessStatuses()); |
50 |
|
} |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
52 |
1 |
@Test... |
53 |
|
public void discardSuccessStatusesFalseWhenDefinedInMailConfig() throws Exception |
54 |
|
{ |
55 |
1 |
ConfigurationSource mailConfigSource = this.mocker.getInstance(ConfigurationSource.class, "mailsend"); |
56 |
1 |
when(mailConfigSource.getProperty("discardSuccessStatuses")).thenReturn(0); |
57 |
|
|
58 |
1 |
assertEquals(false, this.mocker.getComponentUnderTest().discardSuccessStatuses()); |
59 |
|
} |
60 |
|
} |