Examples of HeaderImpl


Examples of org.apache.james.mime4j.message.HeaderImpl

    public void testGetMessageId() throws Exception {
        MessageImpl m = new MessageImpl();
        assertNull(m.getMessageId());

        String id = "<msg17@localhost>";
        Header header = new HeaderImpl();
        header.setField(DefaultFieldParser.parse("Message-ID: " + id));
        m.setHeader(header);
        assertEquals(id, m.getMessageId());
    }
View Full Code Here

Examples of org.apache.james.mime4j.message.HeaderImpl

    public void testGetSubject() throws Exception {
        MessageImpl m = new MessageImpl();
        assertNull(m.getSubject());

        String subject = "testing 1 2";
        Header header = new HeaderImpl();
        header.setField(DefaultFieldParser.parse("Subject: " + subject));
        m.setHeader(header);
        assertEquals(subject, m.getSubject());

        header.setField(DefaultFieldParser.parse("Subject: =?windows-1252?Q?99_=80?="));
        assertEquals("99 \u20ac", m.getSubject());
    }
View Full Code Here

Examples of org.apache.james.mime4j.message.HeaderImpl

    public void testGetDate() throws Exception {
        MessageImpl m = new MessageImpl();
        assertNull(m.getDate());

        Header header = new HeaderImpl();
        header.setField(DefaultFieldParser.parse("Date: Thu, 1 Jan 1970 05:30:00 +0530"));
        m.setHeader(header);

        assertEquals(new Date(0), m.getDate());
    }
View Full Code Here

Examples of org.apache.james.mime4j.message.HeaderImpl

    public void testGetSender() throws Exception {
        MessageImpl m = new MessageImpl();
        assertNull(m.getSender());

        Header header = new HeaderImpl();
        header.setField(DefaultFieldParser.parse("Sender: john.doe@example.net"));
        m.setHeader(header);

        assertEquals("john.doe@example.net", m.getSender().getAddress());
    }
View Full Code Here

Examples of org.apache.james.mime4j.message.HeaderImpl

    public void testGetFrom() throws Exception {
        MessageImpl m = new MessageImpl();
        assertNull(m.getFrom());

        Header header = new HeaderImpl();
        header.setField(DefaultFieldParser.parse("From: john.doe@example.net"));
        m.setHeader(header);

        assertEquals("john.doe@example.net", m.getFrom().get(0).getAddress());
    }
View Full Code Here

Examples of org.apache.james.mime4j.message.HeaderImpl

    public void testGetTo() throws Exception {
        MessageImpl m = new MessageImpl();
        assertNull(m.getTo());

        Header header = new HeaderImpl();
        header.setField(DefaultFieldParser.parse("To: john.doe@example.net"));
        m.setHeader(header);

        assertEquals("john.doe@example.net", ((Mailbox) m.getTo().get(0))
                .getAddress());
    }
View Full Code Here

Examples of org.apache.james.mime4j.message.HeaderImpl

    public void testGetCc() throws Exception {
        MessageImpl m = new MessageImpl();
        assertNull(m.getCc());

        Header header = new HeaderImpl();
        header.setField(DefaultFieldParser.parse("Cc: john.doe@example.net"));
        m.setHeader(header);

        assertEquals("john.doe@example.net", ((Mailbox) m.getCc().get(0))
                .getAddress());
    }
View Full Code Here

Examples of org.apache.james.mime4j.message.HeaderImpl

    public void testGetBcc() throws Exception {
        MessageImpl m = new MessageImpl();
        assertNull(m.getBcc());

        Header header = new HeaderImpl();
        header.setField(DefaultFieldParser.parse("Bcc: john.doe@example.net"));
        m.setHeader(header);

        assertEquals("john.doe@example.net", ((Mailbox) m.getBcc().get(0))
                .getAddress());
    }
View Full Code Here

Examples of org.apache.james.mime4j.message.HeaderImpl

    public void testGetReplyTo() throws Exception {
        MessageImpl m = new MessageImpl();
        assertNull(m.getReplyTo());

        Header header = new HeaderImpl();
        header.setField(DefaultFieldParser.parse("Reply-To: john.doe@example.net"));
        m.setHeader(header);

        assertEquals("john.doe@example.net", ((Mailbox) m.getReplyTo().get(0))
                .getAddress());
    }
View Full Code Here

Examples of org.apache.james.mime4j.message.HeaderImpl

        assertNull(copy.getParent());
    }

    public void testCopyMessage() throws Exception {
        MessageImpl parent = new MessageImpl();
        Header header = new HeaderImpl();
        Body body = new BasicBodyFactory().textBody("test");

        MessageImpl original = new MessageImpl();
        original.setHeader(header);
        original.setBody(body);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.