Class EMailTest

  • All Implemented Interfaces:
    junit.framework.Test

    public class EMailTest
    extends junit.framework.TestCase
    The class EMailTest contains tests for the class EMail

    Version:
    $Id: EMailTest.java,v 1.2 2006/07/30 00:54:36 jjanke Exp $
    Author:
    Jorg Janke
    • Constructor Summary

      Constructors 
      Constructor Description
      EMailTest​(String name)
      Construct new test instance
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void main​(String[] args)
      Launch the test.
      protected void setUp()
      Perform pre-test initialization
      void testAttachmentHTML()
      Test sending to internal public void testInternal() { EMail emailTest = new EMail(host, from, from, "TestInternal", "Test Internal Message"); assertEquals(emailTest.send(), EMail.SENT_OK); } // testInternal /** Test sending to internal authenticated public void testInternalAuthenticate() { EMail emailTest = new EMail(host, from, from, "TestInternalAuthenticate", "Test Internal Authenticate Message"); emailTest.setEMailUser(usr, pwd); assertEquals(emailTest.send(), EMail.SENT_OK); } // testInternalAuthenticate /** Test sending to external public void testExternal() { EMail emailTest = new EMail(host, from, to, "TestExternal", "Test External Message"); assertNotSame(emailTest.send(), EMail.SENT_OK); } // testExternal /** Test sending to external authenticated public void testExternalAuthenticate() { EMail emailTest = new EMail(host, from, to, "TestExternalAuthenticate", "Test External Authenticate Message"); emailTest.setEMailUser(usr, pwd); assertEquals(emailTest.send(), EMail.SENT_OK); } // testExternalAuthenticate /** Test sending HTML public void testHTML() { EMail emailTest = new EMail(host, from, to); emailTest.addCc(to2); emailTest.setMessageHTML("TestHTML", "Test HTML Message"); emailTest.setEMailUser(usr, pwd); assertEquals(emailTest.send(), EMail.SENT_OK); } // testHTML /** Test sending Attachment public void testAttachment() { EMail emailTest = new EMail(host, from, to, "TestAttachment", "Test Attachment Message"); emailTest.addTo(to2); emailTest.addCc(to3); emailTest.addAttachment(new File("C:\\Adempiere\\RUN_Adempiere.sh")); emailTest.setEMailUser(usr, pwd); assertEquals(emailTest.send(), EMail.SENT_OK); } // testAttachmentHTML /** Test sending Attachment HTML
      • Methods inherited from class junit.framework.TestCase

        assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, tearDown, toString
    • Constructor Detail

      • EMailTest

        public EMailTest​(String name)
        Construct new test instance
        Parameters:
        name - the test name
    • Method Detail

      • setUp

        protected void setUp()
                      throws Exception
        Perform pre-test initialization
        Overrides:
        setUp in class junit.framework.TestCase
        Throws:
        Exception
        See Also:
        TestCase.setUp()
      • testAttachmentHTML

        public void testAttachmentHTML()
        Test sending to internal public void testInternal() { EMail emailTest = new EMail(host, from, from, "TestInternal", "Test Internal Message"); assertEquals(emailTest.send(), EMail.SENT_OK); } // testInternal /** Test sending to internal authenticated public void testInternalAuthenticate() { EMail emailTest = new EMail(host, from, from, "TestInternalAuthenticate", "Test Internal Authenticate Message"); emailTest.setEMailUser(usr, pwd); assertEquals(emailTest.send(), EMail.SENT_OK); } // testInternalAuthenticate /** Test sending to external public void testExternal() { EMail emailTest = new EMail(host, from, to, "TestExternal", "Test External Message"); assertNotSame(emailTest.send(), EMail.SENT_OK); } // testExternal /** Test sending to external authenticated public void testExternalAuthenticate() { EMail emailTest = new EMail(host, from, to, "TestExternalAuthenticate", "Test External Authenticate Message"); emailTest.setEMailUser(usr, pwd); assertEquals(emailTest.send(), EMail.SENT_OK); } // testExternalAuthenticate /** Test sending HTML public void testHTML() { EMail emailTest = new EMail(host, from, to); emailTest.addCc(to2); emailTest.setMessageHTML("TestHTML", "Test HTML Message"); emailTest.setEMailUser(usr, pwd); assertEquals(emailTest.send(), EMail.SENT_OK); } // testHTML /** Test sending Attachment public void testAttachment() { EMail emailTest = new EMail(host, from, to, "TestAttachment", "Test Attachment Message"); emailTest.addTo(to2); emailTest.addCc(to3); emailTest.addAttachment(new File("C:\\Adempiere\\RUN_Adempiere.sh")); emailTest.setEMailUser(usr, pwd); assertEquals(emailTest.send(), EMail.SENT_OK); } // testAttachmentHTML /** Test sending Attachment HTML
      • main

        public static void main​(String[] args)
        Launch the test.
        Parameters:
        args - String[]