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.HtmlEmail;
25
26 /**
27 * Extension of the HtmlEmail 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: MockHtmlEmailConcrete.java 240033 2005-08-25 10:03:05Z henning $
33 */
34 public class MockHtmlEmailConcrete extends HtmlEmail
35 {
36 /**
37 * Retrieve the message content
38 * @return Message Content
39 */
40 public String getMsg()
41 {
42 try
43 {
44 return this.getPrimaryBodyPart().getContent().toString();
45 }
46 catch (IOException ioE)
47 {
48 return null;
49 }
50 catch (MessagingException msgE)
51 {
52 return null;
53 }
54 }
55
56 /**
57 * Retrieve the text msg
58 * @return Message Content
59 */
60 public String getTextMsg()
61 {
62 return this.text;
63 }
64
65 /**
66 * Retrieve the html msg
67 * @return Message Content
68 */
69 public String getHtmlMsg()
70 {
71 return this.html;
72 }
73
74 /**
75 * @return inlineImages
76 */
77 public List getInlineImages()
78 {
79 return inlineImages;
80 }
81
82 /**
83 * @return fromAddress
84 */
85 public InternetAddress getFromAddress()
86 {
87 return this.fromAddress;
88 }
89
90 /**
91 * @return toList
92 */
93 public List getToList()
94 {
95 return this.toList;
96 }
97
98 /**
99 * @return bccList
100 */
101 public List getBccList()
102 {
103 return this.bccList;
104 }
105
106 /**
107 * @return ccList
108 */
109 public List getCcList()
110 {
111 return this.ccList;
112 }
113
114 }