Package org.apache.james.mime4j.message

Examples of org.apache.james.mime4j.message.DefaultMessageBuilder.copy()


        original.setHeader(header);
        original.setBody(body);
        original.setParent(parent);

        DefaultMessageBuilder builder = new DefaultMessageBuilder();
        Message copy = builder.copy(original);

        assertNotNull(copy.getHeader());
        assertNotSame(header, copy.getHeader());

        assertNotNull(copy.getBody());
View Full Code Here


    public void testCopyEmptyBodyPart() throws Exception {
        BodyPart original = new BodyPart();

        DefaultMessageBuilder builder = new DefaultMessageBuilder();
        BodyPart copy = builder.copy(original);

        assertNull(copy.getHeader());
        assertNull(copy.getBody());
        assertNull(copy.getParent());
    }
View Full Code Here

        original.setHeader(header);
        original.setBody(body);
        original.setParent(parent);

        DefaultMessageBuilder builder = new DefaultMessageBuilder();
        BodyPart copy = builder.copy(original);

        assertNotNull(copy.getHeader());
        assertNotSame(header, copy.getHeader());

        assertNotNull(copy.getBody());
View Full Code Here

    public void testCopyEmptyMultipart() throws Exception {
        Multipart original = new MultipartImpl("mixed");

        DefaultMessageBuilder builder = new DefaultMessageBuilder();
        Multipart copy = builder.copy(original);

        assertSame(original.getPreamble(), copy.getPreamble());
        assertSame(original.getEpilogue(), copy.getEpilogue());
        assertSame(original.getSubType(), copy.getSubType());
        assertTrue(copy.getBodyParts().isEmpty());
View Full Code Here

        original.setEpilogue("epilogue");
        original.setParent(parent);
        original.addBodyPart(bodyPart);

        DefaultMessageBuilder builder = new DefaultMessageBuilder();
        Multipart copy = builder.copy(original);

        assertSame(original.getPreamble(), copy.getPreamble());
        assertSame(original.getEpilogue(), copy.getEpilogue());
        assertSame(original.getSubType(), copy.getSubType());
        assertEquals(1, copy.getBodyParts().size());
View Full Code Here

        MessageImpl original = new MessageImpl();
        original.setHeader(new HeaderImpl());
        original.setBody(multipart);

        DefaultMessageBuilder builder = new DefaultMessageBuilder();
        Message copy = builder.copy(original);

        Multipart multipartCopy = (Multipart) copy.getBody();
        List<Entity> bodyParts = multipartCopy.getBodyParts();
        Entity bodyPartCopy1 = bodyParts.get(0);
        Entity bodyPartCopy2 = bodyParts.get(1);
View Full Code Here

        original.addField(f1);
        original.addField(f2);
        original.addField(f3);

        DefaultMessageBuilder builder = new DefaultMessageBuilder();
        Header copy = builder.copy(original);

        // copy must have same fields as original
        assertEquals(Arrays.asList(f1, f2, f3), copy.getFields());
        assertEquals(Arrays.asList(f1, f3), copy.getFields("name1"));
View Full Code Here

    public void testCopyEmptyMessage() throws Exception {
        MessageImpl original = new MessageImpl();

        DefaultMessageBuilder builder = new DefaultMessageBuilder();
        Message copy = builder.copy(original);

        assertNull(copy.getHeader());
        assertNull(copy.getBody());
        assertNull(copy.getParent());
    }
View Full Code Here

        original.setHeader(header);
        original.setBody(body);
        original.setParent(parent);

        DefaultMessageBuilder builder = new DefaultMessageBuilder();
        Message copy = builder.copy(original);

        assertNotNull(copy.getHeader());
        assertNotSame(header, copy.getHeader());

        assertNotNull(copy.getBody());
View Full Code Here

    public void testCopyEmptyBodyPart() throws Exception {
        BodyPart original = new BodyPart();

        DefaultMessageBuilder builder = new DefaultMessageBuilder();
        BodyPart copy = builder.copy(original);

        assertNull(copy.getHeader());
        assertNull(copy.getBody());
        assertNull(copy.getParent());
    }
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.