Package org.apache.james.mime4j.field.address

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


            if (addressList != null && addressList.isEmpty() == false) {
                Address address = addressList.get(0);
                if (address instanceof Mailbox) {
                    return getDisplayAddress((Mailbox) address);
                } else if (address instanceof Group) {
                    Group group = (Group) address;
                    if (group != null) {
                        MailboxList mList = group.getMailboxes();
                        if (mList != null && mList.isEmpty() == false) {
                            return getDisplayAddress(mList.get(0));
                        }
                    }
                }
View Full Code Here


    public void testTo() throws Exception {
        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
        Group group = new Group("The Does", mailbox1, mailbox2);

        AddressListField field = Fields.to(group);
        assertEquals("To: The Does: JD <john.doe@acme.org>, "
                + "jane.doe@example.org;", decode(field.getRaw()));
View Full Code Here

    public void testCc() throws Exception {
        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
        Group group = new Group("The Does", mailbox1, mailbox2);

        AddressListField field = Fields.cc(group);
        assertEquals("Cc: The Does: JD <john.doe@acme.org>, "
                + "jane.doe@example.org;", decode(field.getRaw()));
View Full Code Here

    public void testBcc() throws Exception {
        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
        Group group = new Group("The Does", mailbox1, mailbox2);

        AddressListField field = Fields.bcc(group);
        assertEquals("Bcc: The Does: JD <john.doe@acme.org>, "
                + "jane.doe@example.org;", decode(field.getRaw()));
View Full Code Here

    public void testReplyTo() throws Exception {
        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
        Group group = new Group("The Does", mailbox1, mailbox2);

        AddressListField field = Fields.replyTo(group);
        assertEquals("Reply-To: The Does: JD <john.doe@acme.org>, "
                + "jane.doe@example.org;", decode(field.getRaw()));
View Full Code Here

    public void testAddressList() throws Exception {
        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
        Mailbox mailbox3 = Mailbox.parse("Mary Smith <mary@example.net>");
        Group group = new Group("The Does", mailbox1, mailbox2);

        AddressListField field = Fields.addressList("Resent-To", Arrays.asList(
                group, mailbox3));
        assertEquals("Resent-To: The Does: JD <john.doe@acme.org>, "
                + "jane.doe@example.org;, Mary\r\n Smith <mary@example.net>",
View Full Code Here

    public void testSetTo() throws Exception {
        Message m = new Message();

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

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

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

        Mailbox mailbox1 = Mailbox.parse("john.doe@example.net");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.net");
        Group group = new Group("Does", mailbox1, mailbox2);
        Mailbox mailbox3 = Mailbox.parse("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 {
        Message m = new Message();

        Mailbox mailbox1 = Mailbox.parse("john.doe@example.net");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.net");
        Group group = new Group("Does", mailbox1, mailbox2);
        Mailbox mailbox3 = Mailbox.parse("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 {
        Message m = new Message();

        Mailbox mailbox1 = Mailbox.parse("john.doe@example.net");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.net");
        Group group = new Group("Does", mailbox1, mailbox2);
        Mailbox mailbox3 = Mailbox.parse("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

TOP

Related Classes of org.apache.james.mime4j.field.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.