001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.commons.mail.mocks; 018 019 import java.util.List; 020 import java.util.Map; 021 022 import javax.mail.Authenticator; 023 import javax.mail.Session; 024 import javax.mail.internet.InternetAddress; 025 import javax.mail.internet.MimeMessage; 026 import javax.mail.internet.MimeMultipart; 027 028 import org.apache.commons.mail.Email; 029 import org.apache.commons.mail.EmailException; 030 031 /** 032 * Concrete Implementation on the Abstract Email 033 * Class (used to allow testing only). Supplies 034 * getters for methods that normally only have setters. 035 * 036 * @since 1.0 037 * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a> 038 * @version $Id: MockEmailConcrete.java 480401 2006-11-29 04:40:04Z bayard $ 039 */ 040 public class MockEmailConcrete extends Email 041 { 042 043 /** 044 * Not Implemented, should be implemented in subclasses of Email 045 * @param msg The email message 046 * @return Email msg. 047 */ 048 public Email setMsg(String msg) 049 { 050 // This abstract method should be tested in the concrete 051 // implementation classes only. 052 return null; 053 } 054 055 /** 056 * Retrieve the current debug setting 057 * @return debug 058 */ 059 public boolean isDebug() 060 { 061 return this.debug; 062 } 063 064 /** 065 * Retrieve the current authentication setting 066 * @return Authenticator Authenticator 067 */ 068 public Authenticator getAuthenticator() 069 { 070 return this.authenticator; 071 } 072 073 /** 074 * @return bccList 075 */ 076 public List getBccList() 077 { 078 return this.bccList; 079 } 080 081 /** 082 * @return ccList 083 */ 084 public List getCcList() 085 { 086 return this.ccList; 087 } 088 089 /** 090 * @return charset 091 */ 092 public String getCharset() 093 { 094 return this.charset; 095 } 096 097 /** 098 * @return content 099 */ 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 }