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.internet;
19
20 import java.io.IOException;
21 import java.util.Properties;
22 import javax.mail.MessagingException;
23 import javax.mail.Session;
24 import javax.activation.CommandMap;
25 import javax.activation.MailcapCommandMap;
26
27 import junit.framework.TestCase;
28
29 /**
30 * @version $Rev: 154541 $ $Date: 2005-02-20 10:01:49 -0800 (Sun, 20 Feb 2005) $
31 */
32 public class MimeMessageTest extends TestCase {
33 private CommandMap defaultMap;
34 private Session session;
35
36 public void testWriteTo() throws MessagingException, IOException {
37 /*
38 MimeMessage msg = new MimeMessage(session);
39 msg.setSender(new InternetAddress("foo"));
40 MimeMultipart mp = new MimeMultipart();
41 MimeBodyPart part1 = new MimeBodyPart();
42 part1.setContent("Hello World", "text/plain");
43 mp.addBodyPart(part1);
44 msg.setContent(mp);
45 msg.writeTo(System.out);
46 */
47 }
48
49 protected void setUp() throws Exception {
50 defaultMap = CommandMap.getDefaultCommandMap();
51 MailcapCommandMap myMap = new MailcapCommandMap();
52 myMap.addMailcap("text/plain;; x-java-content-handler=" + MimeMultipartTest.DummyTextHandler.class.getName());
53 CommandMap.setDefaultCommandMap(myMap);
54 session = Session.getDefaultInstance(new Properties());
55 }
56
57 protected void tearDown() throws Exception {
58 CommandMap.setDefaultCommandMap(defaultMap);
59 }
60 }