SmtpClient { static final InternetAddress[] transform(Set<String> _recipients) { Set<InternetAddress> recipients = new HashSet<InternetAddress>(); for (String to : _recipients) { try { recipients.add(InternetAddress.parse(to)[0]); } catch (AddressException e) { log.error("[" + to + "] is not a valid email address"); } } return recipients.toArray(new InternetAddress[recipients.size()]); } SmtpClient(); void send(@NotNull org.eclipse.steady.backend.util.Message _msg); static Properties getSmtpProperties(Configuration _cfg); static final String SMTP_HOST; static final String SMTP_PORT; static final String SMTP_USER; static final String SMTP_PWD; }
@Test public void testTransform() { final Set<String> addresses = new HashSet<String>(); assertEquals(0, SmtpClient.transform(addresses).length); addresses.add("foo@bar.com"); assertEquals(1, SmtpClient.transform(addresses).length); }