Package mireka.address.parser.ast

Examples of mireka.address.parser.ast.RecipientAST


     * @throws IllegalArgumentException
     *             if the syntax of the supplied mailbox is invalid.
     */
    public RecipientSpecification create(String mailbox)
            throws IllegalArgumentException {
        RecipientAST recipientAST;
        try {
            recipientAST = new RecipientParser("<" + mailbox + ">").parse();
        } catch (ParseException e) {
            throw new IllegalArgumentException(e);
        }
View Full Code Here


    public RecipientParser(String source) {
        super(source);
    }

    public RecipientAST parse() throws ParseException {
        RecipientAST recipientAST = parseRecipient();
        if (currentToken.ch != -1)
            throw currentToken.otherSyntaxException("Superfluous characters "
                    + "after recipient: {0}");
        return recipientAST;
    }
View Full Code Here

import org.junit.Test;

public class RecipientParserTest {
    @Test
    public void testSystemPostmaster() throws Exception {
        RecipientAST recipientAST = new RecipientParser("<POSTMASTER>").parse();
        assertTrue(recipientAST instanceof SystemPostmasterRecipientAST);
        assertEquals("POSTMASTER",
                ((SystemPostmasterRecipientAST) recipientAST).postmasterSpelling);
    }
View Full Code Here

                ((SystemPostmasterRecipientAST) recipientAST).postmasterSpelling);
    }

    @Test
    public void testDomainPostmaster() throws Exception {
        RecipientAST recipientAST =
                new RecipientParser("<POSTMASTER@example.com>").parse();
        assertTrue(recipientAST instanceof DomainPostmasterRecipientAST);
        assertEquals(
                "POSTMASTER",
                ((DomainPostmasterRecipientAST) recipientAST).mailboxAST.localPartAST.spelling);
View Full Code Here

                ((DomainPostmasterRecipientAST) recipientAST).mailboxAST.localPartAST.spelling);
    }

    @Test
    public void testAlmostDomainPostmaster() throws Exception {
        RecipientAST recipientAST =
                new RecipientParser("<Postmaster@[192.0.2.0]>").parse();
        assertTrue(recipientAST instanceof MailboxRecipientAST);
        assertEquals("Postmaster",
                ((MailboxRecipientAST) recipientAST).pathAST.mailboxAST.localPartAST.spelling);
    }
View Full Code Here

                ((MailboxRecipientAST) recipientAST).pathAST.mailboxAST.localPartAST.spelling);
    }

    @Test
    public void testMailboxRecipient() throws Exception {
        RecipientAST recipientAST = new RecipientParser("<john@example.com>").parse();
        assertTrue(recipientAST instanceof MailboxRecipientAST);
        assertEquals("john",
                ((MailboxRecipientAST) recipientAST).pathAST.mailboxAST.localPartAST.spelling);
    }
View Full Code Here

TOP

Related Classes of mireka.address.parser.ast.RecipientAST

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.