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 Description TestMailErrorHandler()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
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 interfaceMailErrorHandler
- Parameters:
failedMessage
- the failed messageex
- the exception that caused the failure
getFailedMessages
public java.util.List<org.springframework.mail.MailMessage> getFailedMessages()
clear
public void clear()