1 package com.mockobjects.mail; 2 3 import alt.javax.mail.Message; 4 5 import javax.mail.Address ; 6 import javax.mail.MessagingException ; 7 import javax.mail.Flags ; 8 import javax.mail.Multipart ; 9 import javax.activation.DataHandler ; 10 import java.util.Date ; 11 import java.util.Enumeration ; 12 import java.io.InputStream ; 13 import java.io.IOException ; 14 import java.io.OutputStream ; 15 16 import com.mockobjects.MockObject; 17 import com.mockobjects.ExpectationValue; 18 19 public class MockMessage extends MockObject implements Message { 20 private final ExpectationValue myFrom = new ExpectationValue("from"); 21 private final ExpectationValue myRecipients = new ExpectationValue("recipients"); 22 private final ExpectationValue mySubject = new ExpectationValue("subject"); 23 private final ExpectationValue mySentDate = new ExpectationValue("sent date"); 24 private final ExpectationValue myText = new ExpectationValue("text"); 25 private final ExpectationValue myContent = new ExpectationValue("content"); 26 private final ExpectationValue myMimeType = new ExpectationValue("mime type"); 27 28 public Address [] getFrom() throws MessagingException { 29 notImplemented(); 30 return new Address [0]; 31 } 32 33 public void setFrom() throws MessagingException { 34 notImplemented(); 35 } 36 37 public void setExpectedFrom(Address anAddress){ 38 myFrom.setExpected(anAddress); 39 } 40 41 public void setFrom(Address anAddress) throws MessagingException { 42 myFrom.setActual(anAddress); 43 } 44 45 public void addFrom(Address [] addresses) throws MessagingException { 46 notImplemented(); 47 } 48 49 public Address [] getRecipients(javax.mail.Message.RecipientType type) throws MessagingException { 50 notImplemented(); 51 return new Address [0]; 52 } 53 54 public void setExpectedRecipients(Address [] addresses){ 55 myRecipients.setExpected(addresses); 56 } 57 58 public void setRecipients(javax.mail.Message.RecipientType type, Address [] addresses) throws MessagingException { 59 myRecipients.setActual(addresses); 60 } 61 62 public void addRecipients(javax.mail.Message.RecipientType type, Address [] addresses) throws MessagingException { 63 notImplemented(); 64 } 65 66 public String getSubject() throws MessagingException { 67 notImplemented(); 68 return null; 69 } 70 71 public void setSubject(String aSubject) throws MessagingException { 72 mySubject.setActual(aSubject); 73 } 74 75 public void setExpectedSubject(String aSubject){ 76 mySubject.setExpected(aSubject); 77 } 78 79 public Date getSentDate() throws MessagingException { 80 notImplemented(); 81 return null; 82 } 83 84 public void setExpectedSentDate(Date aDate){ 85 mySentDate.setExpected(aDate); 86 } 87 88 public void setSentDate(Date aDate) throws MessagingException { 89 mySentDate.setActual(aDate); 90 } 91 92 public Date getReceivedDate() throws MessagingException { 93 notImplemented(); 94 return null; 95 } 96 97 public Flags getFlags() throws MessagingException { 98 notImplemented(); 99 return null; 100 } 101 102 public void setFlags(Flags flags, boolean b) throws MessagingException { 103 notImplemented(); 104 } 105 106 public Message reply(boolean b) throws MessagingException { 107 notImplemented(); 108 return null; 109 } 110 111 public void saveChanges() throws MessagingException { 112 notImplemented(); 113 } 114 115 public int getSize() throws MessagingException { 116 notImplemented(); 117 return 0; 118 } 119 120 public int getLineCount() throws MessagingException { 121 notImplemented(); 122 return 0; 123 } 124 125 public String getContentType() throws MessagingException { 126 notImplemented(); 127 return null; 128 } 129 130 public boolean isMimeType(String s) throws MessagingException { 131 notImplemented(); 132 return false; 133 } 134 135 public String getDisposition() throws MessagingException { 136 notImplemented(); 137 return null; 138 } 139 140 public void setDisposition(String s) throws MessagingException { 141 notImplemented(); 142 } 143 144 public String getDescription() throws MessagingException { 145 notImplemented(); 146 return null; 147 } 148 149 public void setDescription(String s) throws MessagingException { 150 notImplemented(); 151 } 152 153 public String getFileName() throws MessagingException { 154 notImplemented(); 155 return null; 156 } 157 158 public void setFileName(String s) throws MessagingException { 159 notImplemented(); 160 } 161 162 public InputStream getInputStream() throws IOException , MessagingException { 163 notImplemented(); 164 return null; 165 } 166 167 public DataHandler getDataHandler() throws MessagingException { 168 notImplemented(); 169 return null; 170 } 171 172 public Object getContent() throws IOException , MessagingException { 173 notImplemented(); 174 return null; 175 } 176 177 public void setDataHandler(DataHandler handler) throws MessagingException { 178 notImplemented(); 179 } 180 181 182 public void setExpectedContent(Object aContent, String aMimeType){ 183 myContent.setExpected(aContent); 184 myMimeType.setExpected(aMimeType); 185 } 186 187 public void setContent(Object aContent, String aMimeType) throws MessagingException { 188 myContent.setActual(aContent); 189 myMimeType.setActual(aMimeType); 190 } 191 192 public void setExpectedText(String aText){ 193 myText.setExpected(aText); 194 } 195 196 public void setText(String aText) throws MessagingException { 197 myText.setActual(aText); 198 } 199 200 public void setContent(Multipart multipart) throws MessagingException { 201 myContent.setActual(multipart); 202 } 203 204 public void writeTo(OutputStream stream) throws IOException , MessagingException { 205 notImplemented(); 206 } 207 208 public javax.mail.Message getRealMessage() { 209 return null; 210 } 211 212 public String [] getHeader(String s) throws MessagingException { 213 notImplemented(); 214 return new String [0]; 215 } 216 217 public void setHeader(String s, String s1) throws MessagingException { 218 notImplemented(); 219 } 220 221 public void addHeader(String s, String s1) throws MessagingException { 222 notImplemented(); 223 } 224 225 public void removeHeader(String s) throws MessagingException { 226 notImplemented(); 227 } 228 229 public Enumeration getAllHeaders() throws MessagingException { 230 notImplemented(); 231 return null; 232 } 233 234 public Enumeration getMatchingHeaders(String [] strings) throws MessagingException { 235 notImplemented(); 236 return null; 237 } 238 239 public Enumeration getNonMatchingHeaders(String [] strings) throws MessagingException { 240 notImplemented(); 241 return null; 242 } 243 } 244 | Popular Tags |