@Test void replaceMailAddressesShouldReturnEmptyWhenAddressesMatchUnaltered() throws Exception { FakeMail mail = FakeMail.builder() .name("name") .build(); Collection<MailAddress> addresses = testee.replaceSpecialAddresses(mail, ImmutableList.of(SpecialAddress.UNALTERED)); assertThat(addresses).isEmpty(); }
public List<MailAddress> replaceSpecialAddresses(Mail mailWithReplacementAddresses, List<MailAddress> mailAddresses) { ImmutableList.Builder<MailAddress> builder = ImmutableList.builder(); for (MailAddress mailAddress : mailAddresses) { builder.addAll(getCorrespondingAddress(mailWithReplacementAddresses, mailAddress)); } return builder.build(); }
SpecialAddressesUtils { public List<MailAddress> replaceSpecialAddresses(Mail mailWithReplacementAddresses, List<MailAddress> mailAddresses) { ImmutableList.Builder<MailAddress> builder = ImmutableList.builder(); for (MailAddress mailAddress : mailAddresses) { builder.addAll(getCorrespondingAddress(mailWithReplacementAddresses, mailAddress)); } return builder.build(); } }
SpecialAddressesUtils { public List<MailAddress> replaceSpecialAddresses(Mail mailWithReplacementAddresses, List<MailAddress> mailAddresses) { ImmutableList.Builder<MailAddress> builder = ImmutableList.builder(); for (MailAddress mailAddress : mailAddresses) { builder.addAll(getCorrespondingAddress(mailWithReplacementAddresses, mailAddress)); } return builder.build(); } SpecialAddressesUtils(RedirectNotify genericMailet); }
SpecialAddressesUtils { public List<MailAddress> replaceSpecialAddresses(Mail mailWithReplacementAddresses, List<MailAddress> mailAddresses) { ImmutableList.Builder<MailAddress> builder = ImmutableList.builder(); for (MailAddress mailAddress : mailAddresses) { builder.addAll(getCorrespondingAddress(mailWithReplacementAddresses, mailAddress)); } 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> replaceSpecialAddresses(Mail mailWithReplacementAddresses, List<MailAddress> mailAddresses) { ImmutableList.Builder<MailAddress> builder = ImmutableList.builder(); for (MailAddress mailAddress : mailAddresses) { builder.addAll(getCorrespondingAddress(mailWithReplacementAddresses, mailAddress)); } 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);  }