1 /**
2 *
3 * Copyright 2003-2004 The Apache Software Foundation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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
18 package javax.mail;
19 import java.io.IOException;
20 import java.io.InputStream;
21 import java.io.OutputStream;
22 import java.util.Enumeration;
23
24 import javax.activation.DataHandler;
25 import javax.mail.internet.MimeMessage;
26 import junit.framework.TestCase;
27 /**
28 * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
29 */
30 public class MessageContextTest extends TestCase {
31 public void testNothing() {
32 }
33 /*
34 public void testMessageContext() {
35 Part p;
36 MessageContext mc;
37 p = new TestPart();
38 mc = new MessageContext(p);
39 assertSame(p, mc.getPart());
40 assertNull(mc.getMessage());
41 assertNull(mc.getSession());
42
43 Session s = Session.getDefaultInstance(null);
44 MimeMessage m = new MimeMessage(s);
45 p = new TestMultipart(m);
46 mc = new MessageContext(p);
47 assertSame(p, mc.getPart());
48 assertSame(m,mc.getMessage());
49 assertSame(s,mc.getSession());
50
51 }
52 private static class TestMultipart extends Multipart implements Part {
53 public TestMultipart(Part p) {
54 parent = p;
55 }
56 public void writeTo(OutputStream out) throws IOException, MessagingException {
57 }
58 public void addHeader(String name, String value) throws MessagingException {
59 }
60 public Enumeration getAllHeaders() throws MessagingException {
61 return null;
62 }
63 public Object getContent() throws IOException, MessagingException {
64 return null;
65 }
66 public DataHandler getDataHandler() throws MessagingException {
67 return null;
68 }
69 public String getDescription() throws MessagingException {
70 return null;
71 }
72 public String getDisposition() throws MessagingException {
73 return null;
74 }
75 public String getFileName() throws MessagingException {
76 return null;
77 }
78 public String[] getHeader(String name) throws MessagingException {
79 return null;
80 }
81 public InputStream getInputStream() throws IOException, MessagingException {
82 return null;
83 }
84 public int getLineCount() throws MessagingException {
85 return 0;
86 }
87 public Enumeration getMatchingHeaders(String[] names) throws MessagingException {
88 return null;
89 }
90 public Enumeration getNonMatchingHeaders(String[] names) throws MessagingException {
91 return null;
92 }
93 public int getSize() throws MessagingException {
94 return 0;
95 }
96 public boolean isMimeType(String mimeType) throws MessagingException {
97 return false;
98 }
99 public void removeHeader(String name) throws MessagingException {
100 }
101 public void setContent(Multipart content) throws MessagingException {
102 }
103 public void setContent(Object content, String type) throws MessagingException {
104 }
105 public void setDataHandler(DataHandler handler) throws MessagingException {
106 }
107 public void setDescription(String description) throws MessagingException {
108 }
109 public void setDisposition(String disposition) throws MessagingException {
110 }
111 public void setFileName(String name) throws MessagingException {
112 }
113 public void setHeader(String name, String value) throws MessagingException {
114 }
115 public void setText(String content) throws MessagingException {
116 }
117 }
118 private static class TestBodyPart extends BodyPart {
119 public TestBodyPart(Multipart p) {
120 super();
121 parent = p;
122 }
123 public void addHeader(String name, String value)
124 throws MessagingException {
125 }
126 public Enumeration getAllHeaders() throws MessagingException {
127 return null;
128 }
129 public Object getContent() throws IOException, MessagingException {
130 return null;
131 }
132 public String getContentType() throws MessagingException {
133 return null;
134 }
135 public DataHandler getDataHandler() throws MessagingException {
136 return null;
137 }
138 public String getDescription() throws MessagingException {
139 return null;
140 }
141 public String getDisposition() throws MessagingException {
142 return null;
143 }
144 public String getFileName() throws MessagingException {
145 return null;
146 }
147 public String[] getHeader(String name) throws MessagingException {
148 return null;
149 }
150 public InputStream getInputStream()
151 throws IOException, MessagingException {
152 return null;
153 }
154 public int getLineCount() throws MessagingException {
155 return 0;
156 }
157 public Enumeration getMatchingHeaders(String[] names)
158 throws MessagingException {
159 return null;
160 }
161 public Enumeration getNonMatchingHeaders(String[] names)
162 throws MessagingException {
163 return null;
164 }
165 public int getSize() throws MessagingException {
166 return 0;
167 }
168 public boolean isMimeType(String mimeType) throws MessagingException {
169 return false;
170 }
171 public void removeHeader(String name) throws MessagingException {
172 }
173 public void setContent(Multipart content) throws MessagingException {
174 }
175 public void setContent(Object content, String type)
176 throws MessagingException {
177 }
178 public void setDataHandler(DataHandler handler)
179 throws MessagingException {
180 }
181 public void setDescription(String description)
182 throws MessagingException {
183 }
184 public void setDisposition(String disposition)
185 throws MessagingException {
186 }
187 public void setFileName(String name) throws MessagingException {
188 }
189 public void setHeader(String name, String value)
190 throws MessagingException {
191 }
192 public void setText(String content) throws MessagingException {
193 }
194 public void writeTo(OutputStream out)
195 throws IOException, MessagingException {
196 }
197 }
198 private static class TestPart implements Part {
199 public void addHeader(String name, String value)
200 throws MessagingException {
201 }
202 public Enumeration getAllHeaders() throws MessagingException {
203 return null;
204 }
205 public Object getContent() throws IOException, MessagingException {
206 return null;
207 }
208 public String getContentType() throws MessagingException {
209 return null;
210 }
211 public DataHandler getDataHandler() throws MessagingException {
212 return null;
213 }
214 public String getDescription() throws MessagingException {
215 return null;
216 }
217 public String getDisposition() throws MessagingException {
218 return null;
219 }
220 public String getFileName() throws MessagingException {
221 return null;
222 }
223 public String[] getHeader(String name) throws MessagingException {
224 return null;
225 }
226 public InputStream getInputStream()
227 throws IOException, MessagingException {
228 return null;
229 }
230 public int getLineCount() throws MessagingException {
231 return 0;
232 }
233 public Enumeration getMatchingHeaders(String[] names)
234 throws MessagingException {
235 return null;
236 }
237 public Enumeration getNonMatchingHeaders(String[] names)
238 throws MessagingException {
239 return null;
240 }
241 public int getSize() throws MessagingException {
242 return 0;
243 }
244 public boolean isMimeType(String mimeType) throws MessagingException {
245 return false;
246 }
247 public void removeHeader(String name) throws MessagingException {
248 }
249 public void setContent(Multipart content) throws MessagingException {
250 }
251 public void setContent(Object content, String type)
252 throws MessagingException {
253 }
254 public void setDataHandler(DataHandler handler)
255 throws MessagingException {
256 }
257 public void setDescription(String description)
258 throws MessagingException {
259 }
260 public void setDisposition(String disposition)
261 throws MessagingException {
262 }
263 public void setFileName(String name) throws MessagingException {
264 }
265 public void setHeader(String name, String value)
266 throws MessagingException {
267 }
268 public void setText(String content) throws MessagingException {
269 }
270 public void writeTo(OutputStream out)
271 throws IOException, MessagingException {
272 }
273 }
274 */
275 }