Class TestMailErrorHandler

  • All Implemented Interfaces:
    MailErrorHandler

    public class TestMailErrorHandler
    extends java.lang.Object
    implements MailErrorHandler
    This handler prints out failed messages with their exceptions. It also maintains a list of all failed messages it receives for lookup later by an assertion.
    Since:
    2.1
    Author:
    Dan Garrette, Dave Syer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidclear() 
      java.util.List<org.springframework.mail.MailMessage>getFailedMessages() 
      voidhandle​(org.springframework.mail.MailMessage failedMessage, java.lang.Exception ex)
      This method will be called for each message that failed sending in the chunk.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TestMailErrorHandler

        public TestMailErrorHandler()
    • Method Detail

      • handle

        public void handle​(org.springframework.mail.MailMessage failedMessage,
                           java.lang.Exception ex)
        Description copied from interface: MailErrorHandler
        This method will be called for each message that failed sending in the chunk. If the failed message is needed by the handler it will need to be downcast according to its runtime type. If an exception is thrown from this method, then it will propagate to the caller.
        Specified by:
        handle in interface MailErrorHandler
        Parameters:
        failedMessage - the failed message
        ex - the exception that caused the failure
      • getFailedMessages

        public java.util.List<org.springframework.mail.MailMessage> getFailedMessages()
      • clear

        public void clear()