KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > mail > AttachmentMailTest


1 package info.magnolia.cms.mail;
2
3 import info.magnolia.cms.mail.templates.MailAttachment;
4
5 import java.io.File JavaDoc;
6 import java.net.URL JavaDoc;
7
8 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory;
10
11
12 public class AttachmentMailTest extends AbstractMailTest {
13
14     Logger log = LoggerFactory.getLogger(AttachmentMailTest.class);
15
16     public void testAttachmentFile() throws Exception JavaDoc {
17         String JavaDoc file = getResourcePath(TEST_FILE_PDF);
18         MailAttachment att = new MailAttachment(new File JavaDoc(file).toURL(), "att");
19         URL JavaDoc url = att.getURL();
20         log.info(url.toString());
21         File JavaDoc f = att.getFile();
22         log.info(f.getAbsolutePath());
23         assertTrue(f.exists());
24         assertEquals(f.getAbsolutePath(), file);
25     }
26
27 }
28
Popular Tags