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

File TestMailSenderConfiguration.java

 

Coverage histogram

../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
14
11
1
111
69
11
0.79
1.27
11
1

Classes

Class Line # Actions
TestMailSenderConfiguration 33 14 0% 11 0
1.0100%
 

Contributing tests

This file is covered by 6 tests. .

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.mail.integration;
21   
22    import java.util.ArrayList;
23    import java.util.List;
24    import java.util.Properties;
25   
26    import org.xwiki.mail.internal.configuration.DefaultMailSenderConfiguration;
27   
28    /**
29    * Makes {@link DefaultMailSenderConfiguration} more easily testable.
30    *
31    * @version $Id: fedd447efd8606db59f9ffadabe60a94674a41aa $
32    */
 
33    public class TestMailSenderConfiguration extends DefaultMailSenderConfiguration
34    {
35    private int port;
36   
37    private String username;
38   
39    private String password;
40   
41    private Properties additionalProperties;
42   
43    private List<String> bccAddresses = new ArrayList<>();
44   
 
45  6 toggle public TestMailSenderConfiguration(int port, String username, String password, Properties additionalProperties)
46    {
47  6 this.port = port;
48  6 this.username = username;
49  6 this.password = password;
50  6 this.additionalProperties = additionalProperties;
51    }
52   
 
53  6 toggle @Override
54    public String getHost()
55    {
56  6 return "localhost";
57    }
58   
 
59  6 toggle @Override
60    public int getPort()
61    {
62  6 return this.port;
63    }
64   
 
65  16 toggle @Override
66    public String getFromAddress()
67    {
68  16 return "mary@doe.com";
69    }
70   
 
71  10 toggle @Override
72    public List<String> getBCCAddresses()
73    {
74  10 return this.bccAddresses;
75    }
76   
 
77  15 toggle @Override
78    public String getUsername()
79    {
80  15 return this.username;
81    }
82   
 
83  2 toggle @Override
84    public String getPassword()
85    {
86  2 return this.password;
87    }
88   
 
89  6 toggle @Override
90    public Properties getAdditionalProperties()
91    {
92  6 return this.additionalProperties;
93    }
94   
 
95  2 toggle @Override
96    public String getScriptServicePermissionCheckerHint()
97    {
98  2 return "test";
99    }
100   
 
101  10 toggle @Override
102    public long getSendWaitTime()
103    {
104  10 return 0;
105    }
106   
 
107  1 toggle public void setBCCAddresses(List<String> addresses)
108    {
109  1 this.bccAddresses = addresses;
110    }
111    }