@Test void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnAbsentWhenSenderInitParameterIsEmpty() throws Exception { Optional<MailAddress> sender = testee.getFirstSpecialAddressIfMatchingOrGivenAddress(Optional.of(""), ImmutableList.of("postmaster", "sender", "unaltered")); assertThat(sender).isEmpty(); }
public Optional<MailAddress> getFirstSpecialAddressIfMatchingOrGivenAddress(Optional<String> givenAddress, List<String> allowedSpecials) throws MessagingException { List<MailAddress> extractAddresses = AddressExtractor .withContext(mailet.getMailetContext()) .allowedSpecials(allowedSpecials) .extract(givenAddress); return extractAddresses.stream() .findFirst(); }
SpecialAddressesUtils { public Optional<MailAddress> getFirstSpecialAddressIfMatchingOrGivenAddress(Optional<String> givenAddress, List<String> allowedSpecials) throws MessagingException { List<MailAddress> extractAddresses = AddressExtractor .withContext(mailet.getMailetContext()) .allowedSpecials(allowedSpecials) .extract(givenAddress); return extractAddresses.stream() .findFirst(); } }
SpecialAddressesUtils { public Optional<MailAddress> getFirstSpecialAddressIfMatchingOrGivenAddress(Optional<String> givenAddress, List<String> allowedSpecials) throws MessagingException { List<MailAddress> extractAddresses = AddressExtractor .withContext(mailet.getMailetContext()) .allowedSpecials(allowedSpecials) .extract(givenAddress); return extractAddresses.stream() .findFirst(); } SpecialAddressesUtils(RedirectNotify genericMailet); }
SpecialAddressesUtils { public Optional<MailAddress> getFirstSpecialAddressIfMatchingOrGivenAddress(Optional<String> givenAddress, List<String> allowedSpecials) throws MessagingException { List<MailAddress> extractAddresses = AddressExtractor .withContext(mailet.getMailetContext()) .allowedSpecials(allowedSpecials) .extract(givenAddress); return extractAddresses.stream() .findFirst(); } 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 Optional<MailAddress> getFirstSpecialAddressIfMatchingOrGivenAddress(Optional<String> givenAddress, List<String> allowedSpecials) throws MessagingException { List<MailAddress> extractAddresses = AddressExtractor .withContext(mailet.getMailetContext()) .allowedSpecials(allowedSpecials) .extract(givenAddress); return extractAddresses.stream() .findFirst(); } 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);  }