Package org.apache.james.mime4j.dom.address

Examples of org.apache.james.mime4j.dom.address.Group


    public void testSetCc() throws Exception {
        MessageImpl m = new MessageImpl();

        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
        Group group = new Group("Does", mailbox1, mailbox2);
        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");

        m.setCc(group);
        assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
                .getHeader().getField("Cc").getBody());
View Full Code Here


    public void testSetBcc() throws Exception {
        MessageImpl m = new MessageImpl();

        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
        Group group = new Group("Does", mailbox1, mailbox2);
        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");

        m.setBcc(group);
        assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
                .getHeader().getField("Bcc").getBody());
View Full Code Here

    public void testSetReplyTo() throws Exception {
        MessageImpl m = new MessageImpl();

        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
        Group group = new Group("Does", mailbox1, mailbox2);
        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");

        m.setReplyTo(group);
        assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
                .getHeader().getField("Reply-To").getBody());
View Full Code Here

    }

    public void testEmptyGroup() throws ParseException {
        AddressList addrList = parser.parseAddressList("undisclosed-recipients:;");
        assertEquals(1, addrList.size());
        Group group = (Group)addrList.get(0);
        assertEquals(0, group.getMailboxes().size());
        assertEquals("undisclosed-recipients", group.getName());
    }
View Full Code Here

                "Marketing  folks :  Jane Smith < jane @ example . net >," +
                " \" Jack \\\"Jackie\\\" Jones \" < jjones@example.com > (comment(comment)); ,, (comment)  ," +
                " <@example . net,@example(ignore\\)).com:(ignore)john@(ignore)example.net>");
        assertEquals(2, addrList.size());

        Group group = (Group)addrList.get(0);
        assertEquals("Marketing  folks", group.getName());
        assertEquals(2, group.getMailboxes().size());

        Mailbox mailbox1 = group.getMailboxes().get(0);
        Mailbox mailbox2 = group.getMailboxes().get(1);

        assertEquals("Jane Smith", mailbox1.getName());
        assertEquals("jane", mailbox1.getLocalPart());
        assertEquals("example.net", mailbox1.getDomain());
View Full Code Here

        } catch (ParseException expected) {
        }
    }

    public void testParseGroup() throws Exception {
        Group group = parser.parseGroup(
                "group: john.doe@acme.org, Mary Smith <mary@example.net>;");
        assertEquals("group", group.getName());

        MailboxList mailboxes = group.getMailboxes();
        assertEquals(2, mailboxes.size());

        Mailbox mailbox1 = mailboxes.get(0);
        assertNull(mailbox1.getName());
        assertEquals("john.doe@acme.org", mailbox1.getAddress());
View Full Code Here

    public void testParseGroup() throws Exception {
        String s = "group: john.doe@acme.org, Mary Smith <mary@example.net>";
        ByteSequence raw = ContentUtil.encode(s);
        ParserCursor cursor = new ParserCursor(0, s.length());
        Group group = parser.parseGroup(raw, cursor);
        assertEquals("group", group.getName());

        MailboxList mailboxes = group.getMailboxes();
        assertEquals(2, mailboxes.size());

        Mailbox mailbox1 = mailboxes.get(0);
        assertNull(mailbox1.getName());
        assertEquals("john.doe@acme.org", mailbox1.getAddress());
View Full Code Here

        assertEquals("Mary Smith", mailbox2.getName());
        assertEquals("mary@example.net", mailbox2.getAddress());
    }

    public void testParseInvalidGroup() throws Exception {
        Group group = parser.parseGroup("john.doe@acme.org");
        assertEquals("john.doe@acme.org", group.getName());

        MailboxList mailboxes = group.getMailboxes();
        assertEquals(0, mailboxes.size());
    }
View Full Code Here

        assertEquals("Mary Smith", mbox.getName());
        assertEquals("mary@example.net", mbox.getAddress());

        address = parser.parseAddress("group: Mary Smith <mary@example.net>;");
        assertTrue(address instanceof Group);
        Group group = (Group) address;
        assertEquals("group", group.getName());
        MailboxList mailboxes = group.getMailboxes();
        assertEquals(1, mailboxes.size());
        mbox = mailboxes.get(0);
        assertEquals("Mary Smith", mbox.getName());
        assertEquals("mary@example.net", mbox.getAddress());
    }
View Full Code Here

    }

    public void testEmptyGroup() throws Exception {
        AddressList addrList = parser.parseAddressList("undisclosed-recipients:;");
        assertEquals(1, addrList.size());
        Group group = (Group)addrList.get(0);
        assertEquals(0, group.getMailboxes().size());
        assertEquals("undisclosed-recipients", group.getName());
    }
View Full Code Here

TOP

Related Classes of org.apache.james.mime4j.dom.address.Group

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.