@Test public void matchShouldReturnEmptyCollectionWhenUserAttributeIsPresentAndThereIsNoRecipient() throws Exception { FakeMail fakeMail = FakeMail.builder() .name("name") .recipients() .attribute(new Attribute(MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE, AttributeValue.of("true"))) .build(); Collection<MailAddress> results = testee.match(fakeMail); assertThat(results).isEmpty(); }
@Override public Collection<MailAddress> match(Mail mail) { return AttributeUtils.getAttributeValueFromMail(mail, MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE) .map(ignored -> mail.getRecipients()) .orElse(ImmutableList.of()); }
SentByJmap extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return AttributeUtils.getAttributeValueFromMail(mail, MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE) .map(ignored -> mail.getRecipients()) .orElse(ImmutableList.of()); } }
SentByJmap extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return AttributeUtils.getAttributeValueFromMail(mail, MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE) .map(ignored -> mail.getRecipients()) .orElse(ImmutableList.of()); }  }
SentByJmap extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return AttributeUtils.getAttributeValueFromMail(mail, MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE) .map(ignored -> mail.getRecipients()) .orElse(ImmutableList.of()); }  @Override Collection<MailAddress> match(Mail mail); }
SentByJmap extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return AttributeUtils.getAttributeValueFromMail(mail, MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE) .map(ignored -> mail.getRecipients()) .orElse(ImmutableList.of()); }  @Override Collection<MailAddress> match(Mail mail);  }