public void testCopyMultipartMessage() throws Exception {
BodyPart bodyPart1 = new BodyPart();
BodyPart bodyPart2 = new BodyPart();
Multipart multipart = new MultipartImpl("mixed");
multipart.addBodyPart(bodyPart1);
multipart.addBodyPart(bodyPart2);
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);
assertNotSame(bodyPart1, bodyPartCopy1);
assertEquals(original, bodyPart1.getParent());