org.springframework.batch.sample.domain.mail.internal

## Class TestMailErrorHandler

- java.lang.Object
- - org.springframework.batch.sample.domain.mail.internal.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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TestMailErrorHandler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()`
    `java.util.List<org.springframework.mail.MailMessage>` | `getFailedMessages()`
    `void` | `handle(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()