FileDocCategorySizeDatePackage
MailTransportUnitTests.javaAPI DocAndroid 1.5 API2030Wed May 06 22:42:46 BST 2009com.android.email.mail.transport

MailTransportUnitTests

public class MailTransportUnitTests extends android.test.AndroidTestCase
Simple unit tests for MailSender. Tests here should not attempt any actual connections.

Fields Summary
Constructors Summary
Methods Summary
public voidtestUriParsing()
Tests of the Uri parsing logic


        // Parse with everything in the Uri
        URI uri = new URI("smtp://user:password@server.com:999");
        MailTransport transport = new MailTransport("SMTP");
        transport.setUri(uri, 888);
        assertEquals("server.com", transport.getHost());
        assertEquals(999, transport.getPort());
        String[] userInfoParts = transport.getUserInfoParts();
        assertNotNull(userInfoParts);
        assertEquals("user", userInfoParts[0]);
        assertEquals("password", userInfoParts[1]);

        // Parse with no user/password (e.g. anonymous SMTP)
        uri = new URI("smtp://server.com:999");
        transport = new MailTransport("SMTP");
        transport.setUri(uri, 888);
        assertEquals("server.com", transport.getHost());
        assertEquals(999, transport.getPort());
        assertNull(transport.getUserInfoParts());