org.springframework.mail.MailPreparationException Java Examples
The following examples show how to use
org.springframework.mail.MailPreparationException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProgressImplTest.java From molgenis with GNU Lesser General Public License v3.0 | 6 votes |
@Test void jobFailsAndMailFails() { doThrow(new MailPreparationException("fail!")) .when(mailSender) .send(any(SimpleMailMessage.class)); jobExecution.setProgressMessage("Downloading..."); jobExecution.setFailureEmail("test@Test"); progress.start(); String exceptionMessage = "x is not a number"; Exception ex = new IllegalArgumentException(exceptionMessage); progress.failed(exceptionMessage, ex); verify(mailSender).send(any(SimpleMailMessage.class)); assertEquals(exceptionMessage + " (Mail not sent: fail!)", jobExecution.getProgressMessage()); }
Example #2
Source File: SimpleEmailServiceJavaMailSender.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
@SuppressWarnings("OverloadedVarargsMethod") @Override public void send(MimeMessagePreparator... mimeMessagePreparators) throws MailException { MimeMessage mimeMessage = createMimeMessage(); for (MimeMessagePreparator mimeMessagePreparator : mimeMessagePreparators) { try { mimeMessagePreparator.prepare(mimeMessage); } catch (Exception e) { throw new MailPreparationException(e); } } send(mimeMessage); }
Example #3
Source File: ProgressImplTest.java From molgenis with GNU Lesser General Public License v3.0 | 5 votes |
@Test void jobSucceedsButMailFails() { doThrow(new MailPreparationException("fail!")) .when(mailSender) .send(any(SimpleMailMessage.class)); jobExecution.setProgressMessage("Job finished."); jobExecution.setSuccessEmail("test@Test"); progress.start(); progress.success(); verify(mailSender).send(any(SimpleMailMessage.class)); assertEquals("Job finished. (Mail not sent: fail!)", jobExecution.getProgressMessage()); }
Example #4
Source File: ProgressImplTest.java From molgenis with GNU Lesser General Public License v3.0 | 5 votes |
@Test void jobCanceledAndMailFails() { doThrow(new MailPreparationException("fail!")) .when(mailSender) .send(any(SimpleMailMessage.class)); jobExecution.setProgressMessage("Downloading..."); jobExecution.setFailureEmail("test@Test"); progress.start(); progress.canceled(); verify(mailSender).send(any(SimpleMailMessage.class)); assertEquals("Downloading... (Mail not sent: fail!)", jobExecution.getProgressMessage()); }