@Test
public void shouldFailWithSendFailedExceptionWithAnAuthenticationFailedException(){

	//setup
	ExceptionHandlingMailSendingTemplate doSendWithSendFailedException = new ExceptionHandlingMailSendingTemplate() {
		@Override
		protected boolean doSend(Emailer emailer) throws AddressException, SendFailedException, MessagingException {
			assertNotNull("emailer was constructed", emailer);
			MessagingException firstInnerException = new AuthenticationFailedException("<some authentication failed message from the mailsystem>");
			throw new SendFailedException(BY_OLAT_UNHANDLED_TEXT, firstInnerException);
		}
		
		@Override
		protected MailTemplate getMailTemplate() {
			return emptyMailTemplate;
		};
		
		@Override
		protected List<ContactList> getTheToContactLists() {
			return theContactLists;
		}
		
		@Override
		protected Identity getFromIdentity() {
			return theFromIdentity;
		}
	};	
	
	//exercise
	MessageSendStatus sendStatus = doSendWithSendFailedException.send();
	
	//verify
	assertEquals(MessageSendStatusCode.SMTP_AUTHENTICATION_FAILED, sendStatus.getStatusCode());
	verifyStatusCodeIndicateSendFailedOnly(sendStatus);
	verifySendStatusIsError(sendStatus);
	assertTrue(sendStatus.canProceedWithWorkflow());
}