### Question:
DatabaseMailListener extends AbstractMailListener implements Initializable { @Override public void onSendMessageFatalError(String uniqueMessageId, Exception exception, Map<String, Object> parameters) { super.onSendMessageFatalError(uniqueMessageId, exception, parameters); MailStatus status = retrieveExistingMailStatus(uniqueMessageId, MailState.SEND_FATAL_ERROR); if (status != null) { status.setState(MailState.SEND_FATAL_ERROR); status.setError(exception); saveStatus(status, parameters); } else { this.logger.error("Unable to report the fatal error encountered during mail sending for message [{}] " + "of batch [{}].", uniqueMessageId, getBatchId(), exception); } this.mailStatusResult.incrementCurrentSize(); }  @Override void initialize(); @Override void onPrepareBegin(String batchId, Map<String, Object> parameters); @Override void onPrepareMessageSuccess(ExtendedMimeMessage message, Map<String, Object> parameters); @Override void onPrepareMessageError(ExtendedMimeMessage message, Exception exception, Map<String, Object> parameters); @Override void onPrepareFatalError(Exception exception, Map<String, Object> parameters); @Override void onSendMessageSuccess(ExtendedMimeMessage message, Map<String, Object> parameters); @Override void onSendMessageFatalError(String uniqueMessageId, Exception exception, Map<String, Object> parameters); @Override void onSendMessageError(ExtendedMimeMessage message, Exception exception, Map<String, Object> parameters); @Override MailStatusResult getMailStatusResult();  }### Answer:
@Test public void onSendMessageFatalError() throws Exception { MailStatusStore mailStatusStore = this.mocker.getInstance(MailStatusStore.class, "database"); MailStatus status = new MailStatus(this.batchId, this.message, MailState.PREPARE_SUCCESS); status.setWiki("otherwiki"); when(mailStatusStore.load(this.messageId)).thenReturn(status); MailListener listener = this.mocker.getComponentUnderTest(); listener.onPrepareBegin(batchId, Collections.<String, Object>emptyMap()); listener.onSendMessageFatalError(this.messageId, new Exception("Error"), Collections.<String, Object>emptyMap()); verify(mailStatusStore).load(this.messageId); verify(mailStatusStore).save(argThat(new isSameMailStatus(MailState.SEND_FATAL_ERROR, "otherwiki")), anyMap()); }