1   /*
2    * Copyright 2001-2005 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.commons.mail.mocks;
17  
18  import java.io.IOException;
19  import java.util.List;
20  
21  import javax.mail.MessagingException;
22  import javax.mail.internet.InternetAddress;
23  
24  import org.apache.commons.mail.MultiPartEmail;
25  
26  /**
27   * Extension of MultiPartEmail Class
28   * (used to allow testing only)
29   *
30   * @since 1.0
31   * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
32   * @version $Id: MockMultiPartEmailConcrete.java 240033 2005-08-25 10:03:05Z henning $
33   */
34  public class MockMultiPartEmailConcrete extends MultiPartEmail
35  {
36  
37      /**
38       * Retrieve the message content
39       * @return Message Content
40       */
41      public String getMsg()
42      {
43          try
44          {
45              return this.getPrimaryBodyPart().getContent().toString();
46          }
47          catch (IOException ioE)
48          {
49              return null;
50          }
51          catch (MessagingException msgE)
52          {
53              return null;
54          }
55      }
56  
57      /**
58       */
59      public void initTest()
60      {
61          this.init();
62      }
63  
64      /**
65       * @return fromAddress
66       */
67      public InternetAddress getFromAddress()
68      {
69          return this.fromAddress;
70      }
71  
72      /**
73       * @return toList
74       */
75      public List getToList()
76      {
77          return this.toList;
78      }
79  
80      /**
81       * @return bccList
82       */
83      public List getBccList()
84      {
85          return this.bccList;
86      }
87  
88      /**
89       * @return ccList
90       */
91      public List getCcList()
92      {
93          return this.ccList;
94      }
95  
96  }