@Test void testSendMailsWithExceptionWhilePreparing() { AmazonSimpleEmailService emailService = mock(AmazonSimpleEmailService.class); JavaMailSender mailSender = new SimpleEmailServiceJavaMailSender(emailService); MimeMessage mimeMessage = null; try { mimeMessage = new MimeMessage(Session.getInstance(new Properties())); mailSender.send(new MimeMessage[] { mimeMessage }); fail("Exception expected due to error while sending mail"); } catch (MailSendException e) { assertThat(e.getFailedMessages().size()).isEqualTo(1); assertThat(e.getFailedMessages() .get(mimeMessage) instanceof MailPreparationException).isTrue(); } MimeMessage failureMessage = null; try { failureMessage = new MimeMessage(Session.getInstance(new Properties())) { @Override public void writeTo(OutputStream os) throws MessagingException { throw new MessagingException("exception"); } }; mailSender.send(new MimeMessage[] { failureMessage }); fail("Exception expected due to error while sending mail"); } catch (MailSendException e) { assertThat(e.getFailedMessages().size()).isEqualTo(1); assertThat(e.getFailedMessages() .get(failureMessage) instanceof MailParseException).isTrue(); } }
@Override public void send(MimeMessage mimeMessage) throws MailException { this.send(new MimeMessage[] { mimeMessage }); }
SimpleEmailServiceJavaMailSender extends SimpleEmailServiceMailSender implements JavaMailSender { @Override public void send(MimeMessage mimeMessage) throws MailException { this.send(new MimeMessage[] { mimeMessage }); } }
SimpleEmailServiceJavaMailSender extends SimpleEmailServiceMailSender implements JavaMailSender { @Override public void send(MimeMessage mimeMessage) throws MailException { this.send(new MimeMessage[] { mimeMessage }); } SimpleEmailServiceJavaMailSender(
			AmazonSimpleEmailService amazonSimpleEmailService); }
SimpleEmailServiceJavaMailSender extends SimpleEmailServiceMailSender implements JavaMailSender { @Override public void send(MimeMessage mimeMessage) throws MailException { this.send(new MimeMessage[] { mimeMessage }); } SimpleEmailServiceJavaMailSender(
			AmazonSimpleEmailService amazonSimpleEmailService); void setJavaMailProperties(Properties javaMailProperties); void setSession(Session session); void setDefaultEncoding(String defaultEncoding); void setDefaultFileTypeMap(FileTypeMap defaultFileTypeMap); @Override MimeMessage createMimeMessage(); @Override MimeMessage createMimeMessage(InputStream contentStream); @Override void send(MimeMessage mimeMessage); @SuppressWarnings("OverloadedVarargsMethod") @Override void send(MimeMessage... mimeMessages); @Override void send(MimeMessagePreparator mimeMessagePreparator); @SuppressWarnings("OverloadedVarargsMethod") @Override void send(MimeMessagePreparator... mimeMessagePreparators); }
SimpleEmailServiceJavaMailSender extends SimpleEmailServiceMailSender implements JavaMailSender { @Override public void send(MimeMessage mimeMessage) throws MailException { this.send(new MimeMessage[] { mimeMessage }); } SimpleEmailServiceJavaMailSender(
			AmazonSimpleEmailService amazonSimpleEmailService); void setJavaMailProperties(Properties javaMailProperties); void setSession(Session session); void setDefaultEncoding(String defaultEncoding); void setDefaultFileTypeMap(FileTypeMap defaultFileTypeMap); @Override MimeMessage createMimeMessage(); @Override MimeMessage createMimeMessage(InputStream contentStream); @Override void send(MimeMessage mimeMessage); @SuppressWarnings("OverloadedVarargsMethod") @Override void send(MimeMessage... mimeMessages); @Override void send(MimeMessagePreparator mimeMessagePreparator); @SuppressWarnings("OverloadedVarargsMethod") @Override void send(MimeMessagePreparator... mimeMessagePreparators);  }