public void testNoAttachment() {
}
public void testSimpleAttachment() throws MessagingException, IOException {
Mailet mailet = initMailet();
MimeMessage message = new MimeMessage(Session
.getDefaultInstance(new Properties()));
MimeMultipart mm = new MimeMultipart();
MimeBodyPart mp = new MimeBodyPart();
mp.setText("simple text");
mm.addBodyPart(mp);
String body = "\u0023\u00A4\u00E3\u00E0\u00E9";
MimeBodyPart mp2 = new MimeBodyPart(new ByteArrayInputStream(
("Content-Transfer-Encoding: 8bit\r\nContent-Type: application/octet-stream; charset=utf-8\r\n\r\n" + body).getBytes("UTF-8")));
mp2.setDisposition("attachment");
mp2.setFileName("10.tmp");
mm.addBodyPart(mp2);
String body2 = "\u0014\u00A3\u00E1\u00E2\u00E4";
MimeBodyPart mp3 = new MimeBodyPart(new ByteArrayInputStream(
("Content-Transfer-Encoding: 8bit\r\nContent-Type: application/octet-stream; charset=utf-8\r\n\r\n" + body2).getBytes("UTF-8")));
mp3.setDisposition("attachment");
mp3.setFileName("temp.zip");
mm.addBodyPart(mp3);
message.setSubject("test");
message.setContent(mm);
message.saveChanges();
Mail mail = new FakeMail();
mail.setMessage(message);
mailet.service(mail);
ByteArrayOutputStream rawMessage = new ByteArrayOutputStream();
mail.getMessage().writeTo(rawMessage,
new String[] { "Bcc", "Content-Length", "Message-ID" });