public void testCopyMultipart() throws Exception {
MessageImpl parent = new MessageImpl();
BodyPart bodyPart = new BodyPart();
MultipartImpl original = new MultipartImpl("mixed");
original.setPreamble("preamble");
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());
assertNull(copy.getParent());
Entity bodyPartCopy = copy.getBodyParts().iterator().next();
assertNotSame(bodyPart, bodyPartCopy);