@Override public void setSentDate(Date sentDate) throws MailParseException { try { this.helper.setSentDate(sentDate); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Test public void javaMailSenderWithParseExceptionOnMimeMessagePreparator() { MockJavaMailSender sender = new MockJavaMailSender(); MimeMessagePreparator preparator = new MimeMessagePreparator() { @Override public void prepare(MimeMessage mimeMessage) throws MessagingException { mimeMessage.setFrom(new InternetAddress("")); } }; try { sender.send(preparator); } catch (MailParseException ex) { // expected assertTrue(ex.getCause() instanceof AddressException); } }
@Test public void javaMailSenderWithParseExceptionOnSimpleMessage() { MockJavaMailSender sender = new MockJavaMailSender(); SimpleMailMessage simpleMessage = new SimpleMailMessage(); simpleMessage.setFrom(""); try { sender.send(simpleMessage); } catch (MailParseException ex) { // expected assertTrue(ex.getCause() instanceof AddressException); } }
@Override public void setTo(String... to) throws MailParseException { try { this.helper.setTo(to); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setSubject(String subject) throws MailParseException { try { this.helper.setSubject(subject); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setReplyTo(String replyTo) throws MailParseException { try { this.helper.setReplyTo(replyTo); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setBcc(String bcc) throws MailParseException { try { this.helper.setBcc(bcc); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setBcc(String... bcc) throws MailParseException { try { this.helper.setBcc(bcc); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public MimeMessage createMimeMessage(InputStream contentStream) throws MailException { try { return new MimeMessage(getSession(), contentStream); } catch (Exception ex) { throw new MailParseException("Could not parse raw MIME content", ex); } }
@Override public void setCc(String... cc) throws MailParseException { try { this.helper.setCc(cc); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setText(String text) throws MailParseException { try { this.helper.setText(text); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setFrom(String from) throws MailParseException { try { this.helper.setFrom(from); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setTo(String to) throws MailParseException { try { this.helper.setTo(to); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setCc(String cc) throws MailParseException { try { this.helper.setCc(cc); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setFrom(String from) throws MailParseException { try { this.helper.setFrom(from); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setCc(String cc) throws MailParseException { try { this.helper.setCc(cc); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setCc(String... cc) throws MailParseException { try { this.helper.setCc(cc); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setSubject(String subject) throws MailParseException { try { this.helper.setSubject(subject); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setReplyTo(String replyTo) throws MailParseException { try { this.helper.setReplyTo(replyTo); } catch (MessagingException ex) { throw new MailParseException(ex); } }
@Override public void setTo(String... to) throws MailParseException { try { this.helper.setTo(to); } catch (MessagingException ex) { throw new MailParseException(ex); } }