Package org.apache.james.mime4j.message

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


    private Header headerMultipartMixed = null;
    private Header headerMultipartDigest = null;

    @Override
    public void setUp() throws Exception {
        headerTextPlain = new HeaderImpl();
        headerMessageRFC822 = new HeaderImpl();
        headerEmpty = new HeaderImpl();
        headerMultipartMixed = new HeaderImpl();
        headerMultipartDigest = new HeaderImpl();

        headerTextPlain.addField(
                DefaultFieldParser.parse("Content-Type: text/plain"));
        headerMessageRFC822.addField(
                DefaultFieldParser.parse("Content-Type: message/RFC822"));
View Full Code Here


    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

    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

    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

    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

    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

    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

    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

    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

    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

TOP

Related Classes of org.apache.james.mime4j.message.HeaderImpl

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.