1 package com.ozacc.mail.xml.impl;
2
3 import junit.framework.TestCase;
4
5 import org.jdom.Document;
6 import org.jdom.input.DOMBuilder;
7 import org.jdom.output.XMLOutputter;
8
9 import com.ozacc.mail.Mail;
10 import com.ozacc.mail.xml.XMLBuilder;
11
12 /***
13 *
14 * @author Tomohiro Otsuka
15 * @version $Id: XMLBuilderImplTest.java,v 1.2 2004/09/10 07:36:14 otsuka Exp $
16 */
17 public class XMLBuilderImplTest extends TestCase {
18
19 private XMLBuilder builder;
20
21
22
23
24 protected void setUp() throws Exception {
25 super.setUp();
26
27 builder = new XMLBuilderImpl();
28 }
29
30 public final void testCreateDocument() throws Exception {
31 Mail mail = getMailForTest();
32
33 org.w3c.dom.Document doc = builder.buildDocument(mail);
34
35 DOMBuilder builder = new DOMBuilder();
36 Document jdomDoc = builder.build(doc);
37
38 System.out.println(jdomDoc);
39
40 XMLOutputter outputter = new XMLOutputter();
41 String document = outputter.outputString(jdomDoc);
42 System.out.println(document);
43 }
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 /***
63 * @return
64 */
65 private Mail getMailForTest() {
66 String from = "from@example.com";
67 String fromName = "º¹½Ð¿Í";
68 String to = "info@example.com";
69 String subject = "·?̾";
70 String text = "¥Æ¥¹¥ÈÀ®¸?";
71
72 Mail mail = new Mail();
73 mail.setFrom(from, fromName);
74 mail.addTo(to);
75 mail.setSubject(subject);
76 mail.setText(text);
77 return mail;
78 }
79
80 }