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.io.IOException;
20  import java.util.List;
21  
22  import javax.mail.MessagingException;
23  import javax.mail.internet.InternetAddress;
24  
25  import org.apache.commons.mail.MultiPartEmail;
26  
27  /**
28   * Extension of MultiPartEmail Class
29   * (used to allow testing only)
30   *
31   * @since 1.0
32   * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
33   * @version $Id: MockMultiPartEmailConcrete.java 480401 2006-11-29 04:40:04Z bayard $
34   */
35  public class MockMultiPartEmailConcrete extends MultiPartEmail
36  {
37  
38      /**
39       * Retrieve the message content
40       * @return Message Content
41       */
42      public String getMsg()
43      {
44          try
45          {
46              return this.getPrimaryBodyPart().getContent().toString();
47          }
48          catch (IOException ioE)
49          {
50              return null;
51          }
52          catch (MessagingException msgE)
53          {
54              return null;
55          }
56      }
57  
58      /**
59       */
60      public void initTest()
61      {
62          this.init();
63      }
64  
65      /**
66       * @return fromAddress
67       */
68      public InternetAddress getFromAddress()
69      {
70          return this.fromAddress;
71      }
72  
73      /**
74       * @return toList
75       */
76      public List getToList()
77      {
78          return this.toList;
79      }
80  
81      /**
82       * @return bccList
83       */
84      public List getBccList()
85      {
86          return this.bccList;
87      }
88  
89      /**
90       * @return ccList
91       */
92      public List getCcList()
93      {
94          return this.ccList;
95      }
96  
97  }