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  import java.util.Map;
22  
23  import javax.mail.MessagingException;
24  import javax.mail.internet.InternetAddress;
25  
26  import org.apache.commons.mail.HtmlEmail;
27  
28  /**
29   * Extension of the HtmlEmail Class
30   * (used to allow testing only)
31   *
32   * @since 1.0
33   * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
34   * @version $Id: MockHtmlEmailConcrete.java 578501 2007-09-22 21:18:49Z bspeakmon $
35   */
36  public class MockHtmlEmailConcrete extends HtmlEmail
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       * Retrieve the text msg
60       * @return Message Content
61       */
62      public String getTextMsg()
63      {
64          return this.text;
65      }
66  
67      /**
68       * Retrieve the html msg
69       * @return Message Content
70       */
71      public String getHtmlMsg()
72      {
73          return this.html;
74      }
75  
76      /**
77       * @deprecated as of commons-email 1.1, replaced by {@link #getInlineEmbeds}.
78       */
79      public List getInlineImages()
80      {
81          return inlineImages;
82      }
83  
84      /**
85       * @return inlineEmbeds
86       */
87      public Map getInlineEmbeds()
88      {
89          return inlineEmbeds;
90      }
91  
92      /**
93       * @return fromAddress
94       */
95      public InternetAddress getFromAddress()
96      {
97          return this.fromAddress;
98      }
99  
100     /**
101      * @return toList
102      */
103     public List getToList()
104     {
105         return this.toList;
106     }
107 
108     /**
109      * @return bccList
110      */
111     public List getBccList()
112     {
113         return this.bccList;
114     }
115 
116     /**
117      * @return ccList
118      */
119     public List getCcList()
120     {
121         return this.ccList;
122     }
123 
124 }