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.io.IOException; 020 import java.util.List; 021 import java.util.Map; 022 023 import javax.mail.MessagingException; 024 import javax.mail.internet.InternetAddress; 025 026 import org.apache.commons.mail.HtmlEmail; 027 028 /** 029 * Extension of the HtmlEmail Class 030 * (used to allow testing only) 031 * 032 * @since 1.0 033 * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a> 034 * @version $Id: MockHtmlEmailConcrete.java 578501 2007-09-22 21:18:49Z bspeakmon $ 035 */ 036 public class MockHtmlEmailConcrete extends HtmlEmail 037 { 038 /** 039 * Retrieve the message content 040 * @return Message Content 041 */ 042 public String getMsg() 043 { 044 try 045 { 046 return this.getPrimaryBodyPart().getContent().toString(); 047 } 048 catch (IOException ioE) 049 { 050 return null; 051 } 052 catch (MessagingException msgE) 053 { 054 return null; 055 } 056 } 057 058 /** 059 * Retrieve the text msg 060 * @return Message Content 061 */ 062 public String getTextMsg() 063 { 064 return this.text; 065 } 066 067 /** 068 * Retrieve the html msg 069 * @return Message Content 070 */ 071 public String getHtmlMsg() 072 { 073 return this.html; 074 } 075 076 /** 077 * @deprecated as of commons-email 1.1, replaced by {@link #getInlineEmbeds}. 078 */ 079 public List getInlineImages() 080 { 081 return inlineImages; 082 } 083 084 /** 085 * @return inlineEmbeds 086 */ 087 public Map getInlineEmbeds() 088 { 089 return inlineEmbeds; 090 } 091 092 /** 093 * @return fromAddress 094 */ 095 public InternetAddress getFromAddress() 096 { 097 return this.fromAddress; 098 } 099 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 }