1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.mail.mocks;
18  
19  import java.util.List;
20  import java.util.Map;
21  
22  import javax.mail.Authenticator;
23  import javax.mail.Session;
24  import javax.mail.internet.InternetAddress;
25  import javax.mail.internet.MimeMessage;
26  import javax.mail.internet.MimeMultipart;
27  
28  import org.apache.commons.mail.Email;
29  import org.apache.commons.mail.EmailException;
30  
31  /**
32   * Concrete Implementation on the Abstract Email
33   * Class (used to allow testing only).  Supplies
34   * getters for methods that normally only have setters.
35   *
36   * @since 1.0
37   * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
38   * @version $Id: MockEmailConcrete.java 480401 2006-11-29 04:40:04Z bayard $
39   */
40  public class MockEmailConcrete extends Email
41  {
42  
43      /**
44       * Not Implemented, should be implemented in subclasses of Email
45       * @param msg The email message
46       * @return Email msg.
47       */
48      public Email setMsg(String msg)
49      {
50          // This abstract method should be tested in the concrete
51          // implementation classes only.
52          return null;
53      }
54  
55      /**
56       * Retrieve the current debug setting
57       * @return debug
58       */
59      public boolean isDebug()
60      {
61          return this.debug;
62      }
63  
64      /**
65       * Retrieve the current authentication setting
66       * @return Authenticator Authenticator
67       */
68      public Authenticator getAuthenticator()
69      {
70          return this.authenticator;
71      }
72  
73      /**
74       * @return bccList
75       */
76      public List getBccList()
77      {
78          return this.bccList;
79      }
80  
81      /**
82       * @return ccList
83       */
84      public List getCcList()
85      {
86          return this.ccList;
87      }
88  
89      /**
90       * @return charset
91       */
92      public String getCharset()
93      {
94          return this.charset;
95      }
96  
97      /**
98       * @return content
99       */
100     public Object getContentObject()
101     {
102         return this.content;
103     }
104 
105     /**
106      * @return content
107      */
108     public MimeMultipart getContentMimeMultipart()
109     {
110         return this.emailBody;
111     }
112 
113     /**
114      * @return emailBody
115      */
116     public MimeMultipart getEmailBody()
117     {
118         return this.emailBody;
119     }
120 
121     /**
122      * @return fromAddress
123      */
124     public InternetAddress getFromAddress()
125     {
126         return this.fromAddress;
127     }
128 
129     /**
130      * @return headers
131      */
132     public Map getHeaders()
133     {
134         return this.headers;
135     }
136 
137     /**
138      * @return hostName
139      */
140     public String getHostName()
141     {
142         return this.hostName;
143     }
144 
145     /**
146      * @return message
147      */
148     public MimeMessage getMessage()
149     {
150         return this.message;
151     }
152 
153     /**
154      * @return popHost
155      */
156     public String getPopHost()
157     {
158         return this.popHost;
159     }
160 
161     /**
162      * @return popPassword
163      */
164     public String getPopPassword()
165     {
166         return this.popPassword;
167     }
168 
169     /**
170      * @return popUsername
171      */
172     public String getPopUsername()
173     {
174         return this.popUsername;
175     }
176 
177     /**
178      * @return replyList
179      */
180     public List getReplyList()
181     {
182         return this.replyList;
183     }
184 
185     /**
186      * @return smtpPort
187      */
188     public String getSmtpPort()
189     {
190         return this.smtpPort;
191     }
192 
193     /**
194      * @return subject
195      */
196     public String getSubject()
197     {
198         return this.subject;
199     }
200 
201     /**
202      * @return toList
203      */
204     public List getToList()
205     {
206         return this.toList;
207     }
208 
209     /**
210      * @return contentType
211      */
212     public String getContentType()
213     {
214         return contentType;
215     }
216 
217     /**
218      * @return popBeforeSmtp
219      */
220     public boolean isPopBeforeSmtp()
221     {
222         return popBeforeSmtp;
223     }
224 
225     /**
226      * @return Session
227      * @throws EmailException EmailException
228      */
229     public Session getSession()
230         throws EmailException
231     {
232         return this.getMailSession();
233     }
234 
235 }