@Test(expected = MailException.class) public void send_faild() throws Exception { doThrow(new MailSendException("MailService: Test Exception")).when(mailServiceMock).sendMailWithTemplate(any(TemplateMailTO.class)); mailChannelTestObject.send(subscriber, eventTOs); }
@Retryable public void send(Subscriber subscriber, List<NotificationEventTO> events) throws Exception { try { mailService.sendMailWithTemplate(emailBuilder.getTemplateMailTO(subscriber.getIdentity().getAttributes().getEmail(), events)); } catch (MailException e) { String message = e.getMessage(); if (message != null && !message.isEmpty() && message.indexOf("Invalid Addresses") > 0) { log.error("Invalid Addresses detected !!!", e); throw new InvalidAddressException(e); } throw e; } }
MailChannel implements Channel { @Retryable public void send(Subscriber subscriber, List<NotificationEventTO> events) throws Exception { try { mailService.sendMailWithTemplate(emailBuilder.getTemplateMailTO(subscriber.getIdentity().getAttributes().getEmail(), events)); } catch (MailException e) { String message = e.getMessage(); if (message != null && !message.isEmpty() && message.indexOf("Invalid Addresses") > 0) { log.error("Invalid Addresses detected !!!", e); throw new InvalidAddressException(e); } throw e; } } }
MailChannel implements Channel { @Retryable public void send(Subscriber subscriber, List<NotificationEventTO> events) throws Exception { try { mailService.sendMailWithTemplate(emailBuilder.getTemplateMailTO(subscriber.getIdentity().getAttributes().getEmail(), events)); } catch (MailException e) { String message = e.getMessage(); if (message != null && !message.isEmpty() && message.indexOf("Invalid Addresses") > 0) { log.error("Invalid Addresses detected !!!", e); throw new InvalidAddressException(e); } throw e; } }  }
MailChannel implements Channel { @Retryable public void send(Subscriber subscriber, List<NotificationEventTO> events) throws Exception { try { mailService.sendMailWithTemplate(emailBuilder.getTemplateMailTO(subscriber.getIdentity().getAttributes().getEmail(), events)); } catch (MailException e) { String message = e.getMessage(); if (message != null && !message.isEmpty() && message.indexOf("Invalid Addresses") > 0) { log.error("Invalid Addresses detected !!!", e); throw new InvalidAddressException(e); } throw e; } }  void setMailService(MailService mailService); void setEmailBuilder(EmailBuilder emailBuilder); @Retryable void send(Subscriber subscriber, List<NotificationEventTO> events); Subscriber.Channel getChannelName(); }
MailChannel implements Channel { @Retryable public void send(Subscriber subscriber, List<NotificationEventTO> events) throws Exception { try { mailService.sendMailWithTemplate(emailBuilder.getTemplateMailTO(subscriber.getIdentity().getAttributes().getEmail(), events)); } catch (MailException e) { String message = e.getMessage(); if (message != null && !message.isEmpty() && message.indexOf("Invalid Addresses") > 0) { log.error("Invalid Addresses detected !!!", e); throw new InvalidAddressException(e); } throw e; } }  void setMailService(MailService mailService); void setEmailBuilder(EmailBuilder emailBuilder); @Retryable void send(Subscriber subscriber, List<NotificationEventTO> events); Subscriber.Channel getChannelName();  }