001: /*
002: * Copyright 2001-2005 The Apache Software Foundation
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.apache.commons.mail.mocks;
017:
018: import java.util.List;
019: import java.util.Map;
020:
021: import javax.mail.Authenticator;
022: import javax.mail.Session;
023: import javax.mail.internet.InternetAddress;
024: import javax.mail.internet.MimeMessage;
025: import javax.mail.internet.MimeMultipart;
026:
027: import org.apache.commons.mail.Email;
028: import org.apache.commons.mail.EmailException;
029:
030: /**
031: * Concrete Implementation on the Abstract Email
032: * Class (used to allow testing only). Supplies
033: * getters for methods that normally only have setters.
034: *
035: * @since 1.0
036: * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
037: * @version $Id: MockEmailConcrete.java 240033 2005-08-25 10:03:05Z henning $
038: */
039: public class MockEmailConcrete extends Email {
040:
041: /**
042: * Not Implemented, should be implemented in subclasses of Email
043: * @param msg The email message
044: * @return Email msg.
045: */
046: public Email setMsg(String msg) {
047: // This abstract method should be tested in the concrete
048: // implementation classes only.
049: return null;
050: }
051:
052: /**
053: * Retrieve the current debug setting
054: * @return debug
055: */
056: public boolean isDebug() {
057: return this .debug;
058: }
059:
060: /**
061: * Retrieve the current authentication setting
062: * @return Authenticator Authenticator
063: */
064: public Authenticator getAuthenticator() {
065: return this .authenticator;
066: }
067:
068: /**
069: * @return bccList
070: */
071: public List getBccList() {
072: return this .bccList;
073: }
074:
075: /**
076: * @return ccList
077: */
078: public List getCcList() {
079: return this .ccList;
080: }
081:
082: /**
083: * @return charset
084: */
085: public String getCharset() {
086: return this .charset;
087: }
088:
089: /**
090: * @return content
091: */
092: public Object getContentObject() {
093: return this .content;
094: }
095:
096: /**
097: * @return content
098: */
099: public MimeMultipart getContentMimeMultipart() {
100: return this .emailBody;
101: }
102:
103: /**
104: * @return emailBody
105: */
106: public MimeMultipart getEmailBody() {
107: return this .emailBody;
108: }
109:
110: /**
111: * @return fromAddress
112: */
113: public InternetAddress getFromAddress() {
114: return this .fromAddress;
115: }
116:
117: /**
118: * @return headers
119: */
120: public Map getHeaders() {
121: return this .headers;
122: }
123:
124: /**
125: * @return hostName
126: */
127: public String getHostName() {
128: return this .hostName;
129: }
130:
131: /**
132: * @return message
133: */
134: public MimeMessage getMessage() {
135: return this .message;
136: }
137:
138: /**
139: * @return popHost
140: */
141: public String getPopHost() {
142: return this .popHost;
143: }
144:
145: /**
146: * @return popPassword
147: */
148: public String getPopPassword() {
149: return this .popPassword;
150: }
151:
152: /**
153: * @return popUsername
154: */
155: public String getPopUsername() {
156: return this .popUsername;
157: }
158:
159: /**
160: * @return replyList
161: */
162: public List getReplyList() {
163: return this .replyList;
164: }
165:
166: /**
167: * @return smtpPort
168: */
169: public String getSmtpPort() {
170: return this .smtpPort;
171: }
172:
173: /**
174: * @return subject
175: */
176: public String getSubject() {
177: return this .subject;
178: }
179:
180: /**
181: * @return toList
182: */
183: public List getToList() {
184: return this .toList;
185: }
186:
187: /**
188: * @return contentType
189: */
190: public String getContentType() {
191: return contentType;
192: }
193:
194: /**
195: * @return popBeforeSmtp
196: */
197: public boolean isPopBeforeSmtp() {
198: return popBeforeSmtp;
199: }
200:
201: /**
202: * @return Session
203: * @throws EmailException EmailException
204: */
205: public Session getSession() throws EmailException {
206: return this.getMailSession();
207: }
208:
209: }
|