SMTPAuthUserIs extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return AttributeUtils .getValueAndCastFromMail(mail, Mail.SMTP_AUTH_USER, String.class) .filter(users::contains) .map(ignored -> mail.getRecipients()) .orElse(null); }  @Override void init(); @Override Collection<MailAddress> match(Mail mail);  }
@Override @Test public void testAttributeIsNotMatched() throws MessagingException { setupAll(); setMailAttribute(Attribute.convertToAttribute("notmatched@james.apache.org", "")); Collection<MailAddress> matchedRecipients = matcher.match(mockedMail); assertNull(matchedRecipients); }