@Test void replaceInternetAddressesShouldReturnEmptyWhenAddressesMatchUnaltered() throws Exception { FakeMail mail = FakeMail.builder() .name("name") .build(); List<MailAddress> addresses = testee.replaceInternetAddresses(mail, ImmutableList.of(SpecialAddress.UNALTERED.toInternetAddress())); assertThat(addresses).isEmpty(); }
public List<MailAddress> replaceInternetAddresses(Mail mailWithReplacementAddresses, List<InternetAddress> internetAddresses) throws MessagingException { ImmutableList.Builder<MailAddress> builder = ImmutableList.builder(); for (InternetAddress internetAddress : internetAddresses) { builder.addAll(getCorrespondingAddress(internetAddress, mailWithReplacementAddresses)); } return builder.build(); }
SpecialAddressesUtils { public List<MailAddress> replaceInternetAddresses(Mail mailWithReplacementAddresses, List<InternetAddress> internetAddresses) throws MessagingException { ImmutableList.Builder<MailAddress> builder = ImmutableList.builder(); for (InternetAddress internetAddress : internetAddresses) { builder.addAll(getCorrespondingAddress(internetAddress, mailWithReplacementAddresses)); } return builder.build(); } }
SpecialAddressesUtils { public List<MailAddress> replaceInternetAddresses(Mail mailWithReplacementAddresses, List<InternetAddress> internetAddresses) throws MessagingException { ImmutableList.Builder<MailAddress> builder = ImmutableList.builder(); for (InternetAddress internetAddress : internetAddresses) { builder.addAll(getCorrespondingAddress(internetAddress, mailWithReplacementAddresses)); } return builder.build(); } SpecialAddressesUtils(RedirectNotify genericMailet); }
SpecialAddressesUtils { public List<MailAddress> replaceInternetAddresses(Mail mailWithReplacementAddresses, List<InternetAddress> internetAddresses) throws MessagingException { ImmutableList.Builder<MailAddress> builder = ImmutableList.builder(); for (InternetAddress internetAddress : internetAddresses) { builder.addAll(getCorrespondingAddress(internetAddress, mailWithReplacementAddresses)); } return builder.build(); } SpecialAddressesUtils(RedirectNotify genericMailet); static SpecialAddressesUtils from(RedirectNotify mailet); List<MailAddress> replaceSpecialAddresses(Mail mailWithReplacementAddresses, List<MailAddress> mailAddresses); List<MailAddress> replaceInternetAddresses(Mail mailWithReplacementAddresses, List<InternetAddress> internetAddresses); Optional<MailAddress> getFirstSpecialAddressIfMatchingOrGivenAddress(Optional<String> givenAddress, List<String> allowedSpecials); }
SpecialAddressesUtils { public List<MailAddress> replaceInternetAddresses(Mail mailWithReplacementAddresses, List<InternetAddress> internetAddresses) throws MessagingException { ImmutableList.Builder<MailAddress> builder = ImmutableList.builder(); for (InternetAddress internetAddress : internetAddresses) { builder.addAll(getCorrespondingAddress(internetAddress, mailWithReplacementAddresses)); } return builder.build(); } SpecialAddressesUtils(RedirectNotify genericMailet); static SpecialAddressesUtils from(RedirectNotify mailet); List<MailAddress> replaceSpecialAddresses(Mail mailWithReplacementAddresses, List<MailAddress> mailAddresses); List<MailAddress> replaceInternetAddresses(Mail mailWithReplacementAddresses, List<InternetAddress> internetAddresses); Optional<MailAddress> getFirstSpecialAddressIfMatchingOrGivenAddress(Optional<String> givenAddress, List<String> allowedSpecials);  }