class HasMailAttributeWithValue extends GenericMatcher {

    @Override
    public Collection<MailAddress> match(Mail mail) throws MessagingException {
        return AttributeUtils
            .getAttributeValueFromMail(mail, fieldAttributeName)
            .filter(attributeValue -> attributeValue.toString().trim().equals(fieldAttributeValue))
            .map(any -> mail.getRecipients())
            .orElse(null);
    }

}