KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > mail > MockMessage


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