OSDN Git Service

文字コードを UTF-8、改行コードをLFに統一
[spring-ext/ozacc-mail.git] / src / test / java / com / ozacc / mail / xml / impl / JDomXMLBuilderTest.java
old mode 100755 (executable)
new mode 100644 (file)
index 63ee2b4..3f8d86e
@@ -1,99 +1,99 @@
-package com.ozacc.mail.xml.impl;\r
-\r
-import java.io.File;\r
-\r
-import junit.framework.TestCase;\r
-\r
-import org.apache.log4j.BasicConfigurator;\r
-import org.jdom.Document;\r
-import org.jdom.input.DOMBuilder;\r
-import org.jdom.output.XMLOutputter;\r
-\r
-import com.ozacc.mail.Mail;\r
-\r
-/**\r
- * \r
- * @author Tomohiro Otsuka\r
- * @version $Id: JDomXMLBuilderTest.java,v 1.2.2.1 2004/10/24 10:28:09 otsuka Exp $\r
- */\r
-public class JDomXMLBuilderTest extends TestCase {\r
-\r
-       private JDomXMLBuilder builder;\r
-\r
-       /**\r
-        * @see TestCase#setUp()\r
-        */\r
-       protected void setUp() throws Exception {\r
-               super.setUp();\r
-\r
-               BasicConfigurator.configure();\r
-\r
-               builder = new JDomXMLBuilder();\r
-       }\r
-\r
-       /**\r
-        * @see junit.framework.TestCase#tearDown()\r
-        */\r
-       protected void tearDown() throws Exception {\r
-               BasicConfigurator.resetConfiguration();\r
-       }\r
-\r
-       public final void testCreateDocument() throws Exception {\r
-               Mail mail = getMailForTest();\r
-\r
-               org.w3c.dom.Document doc = builder.buildDocument(mail);\r
-\r
-               DOMBuilder builder = new DOMBuilder();\r
-               Document jdomDoc = builder.build(doc);\r
-\r
-               System.out.println(jdomDoc);\r
-\r
-               XMLOutputter outputter = new XMLOutputter();\r
-               String document = outputter.outputString(jdomDoc);\r
-               System.out.println(document);\r
-\r
-       }\r
-\r
-       /*\r
-        * Class under test for void saveDocument(Mail, File)\r
-        */\r
-       public final void testSaveDocumentMailFile() throws Exception {\r
-               Mail mail = getMailForTest();\r
-\r
-               String filePath = "target/test/data/mail.xml";\r
-               File file = new File(filePath);\r
-               file.getParentFile().mkdirs();\r
-\r
-               builder.saveDocument(mail, file);\r
-       }\r
-\r
-       public final void testSaveDocumentHtml() throws Exception {\r
-               Mail mail = getMailForTest();\r
-               mail.setHtmlText("<html><body>テスト成功</body></html>");\r
-\r
-               String filePath = "target/test/data/mail-jdk-html.xml";\r
-               File file = new File(filePath);\r
-               file.getParentFile().mkdirs();\r
-\r
-               builder.saveDocument(mail, file);\r
-       }\r
-\r
-       /**\r
-        * @return \r
-        */\r
-       private Mail getMailForTest() {\r
-               String from = "from@example.com";\r
-               String fromName = "差出人";\r
-               String to = "info@example.com";\r
-               String subject = "件名";\r
-               String text = "テスト成功\n&<>";\r
-\r
-               Mail mail = new Mail();\r
-               mail.setFrom(from, fromName);\r
-               mail.addTo(to);\r
-               mail.setSubject(subject);\r
-               mail.setText(text);\r
-               return mail;\r
-       }\r
-\r
+package com.ozacc.mail.xml.impl;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.BasicConfigurator;
+import org.jdom.Document;
+import org.jdom.input.DOMBuilder;
+import org.jdom.output.XMLOutputter;
+
+import com.ozacc.mail.Mail;
+
+/**
+ * 
+ * @author Tomohiro Otsuka
+ * @version $Id: JDomXMLBuilderTest.java,v 1.2.2.1 2004/10/24 10:28:09 otsuka Exp $
+ */
+public class JDomXMLBuilderTest extends TestCase {
+
+       private JDomXMLBuilder builder;
+
+       /**
+        * @see TestCase#setUp()
+        */
+       protected void setUp() throws Exception {
+               super.setUp();
+
+               BasicConfigurator.configure();
+
+               builder = new JDomXMLBuilder();
+       }
+
+       /**
+        * @see junit.framework.TestCase#tearDown()
+        */
+       protected void tearDown() throws Exception {
+               BasicConfigurator.resetConfiguration();
+       }
+
+       public final void testCreateDocument() throws Exception {
+               Mail mail = getMailForTest();
+
+               org.w3c.dom.Document doc = builder.buildDocument(mail);
+
+               DOMBuilder builder = new DOMBuilder();
+               Document jdomDoc = builder.build(doc);
+
+               System.out.println(jdomDoc);
+
+               XMLOutputter outputter = new XMLOutputter();
+               String document = outputter.outputString(jdomDoc);
+               System.out.println(document);
+
+       }
+
+       /*
+        * Class under test for void saveDocument(Mail, File)
+        */
+       public final void testSaveDocumentMailFile() throws Exception {
+               Mail mail = getMailForTest();
+
+               String filePath = "target/test/data/mail.xml";
+               File file = new File(filePath);
+               file.getParentFile().mkdirs();
+
+               builder.saveDocument(mail, file);
+       }
+
+       public final void testSaveDocumentHtml() throws Exception {
+               Mail mail = getMailForTest();
+               mail.setHtmlText("<html><body>テスト成功</body></html>");
+
+               String filePath = "target/test/data/mail-jdk-html.xml";
+               File file = new File(filePath);
+               file.getParentFile().mkdirs();
+
+               builder.saveDocument(mail, file);
+       }
+
+       /**
+        * @return 
+        */
+       private Mail getMailForTest() {
+               String from = "from@example.com";
+               String fromName = "差出人";
+               String to = "info@example.com";
+               String subject = "件名";
+               String text = "テスト成功\n&<>";
+
+               Mail mail = new Mail();
+               mail.setFrom(from, fromName);
+               mail.addTo(to);
+               mail.setSubject(subject);
+               mail.setText(text);
+               return mail;
+       }
+
 }
\ No newline at end of file