@Test public void isMarkedAsSpamShouldMatchOnlyRecipientsWithHeaderAndYesValue() throws Exception { FakeMail mail = FakeMail.builder() .name("name") .sender("sender@james.org") .recipients("to1@james.org", "to2@james.org") .addHeaderForRecipient(PerRecipientHeaders.Header.builder() .name("org.apache.james.spamassassin.status") .value("Yes, hits=6.8 required=5.0") .build(), new MailAddress("to1@james.org")) .build(); Collection<MailAddress> matches = matcher.match(mail); assertThat(matches).contains(new MailAddress("to1@james.org")); }
@Override public Collection<MailAddress> match(Mail mail) { return mail.getRecipients() .stream() .filter(recipient -> isMarkedAsSpam(mail, recipient)) .collect(Guavate.toImmutableList()); }
IsMarkedAsSpam extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return mail.getRecipients() .stream() .filter(recipient -> isMarkedAsSpam(mail, recipient)) .collect(Guavate.toImmutableList()); } }
IsMarkedAsSpam extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return mail.getRecipients() .stream() .filter(recipient -> isMarkedAsSpam(mail, recipient)) .collect(Guavate.toImmutableList()); }  }
IsMarkedAsSpam extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return mail.getRecipients() .stream() .filter(recipient -> isMarkedAsSpam(mail, recipient)) .collect(Guavate.toImmutableList()); }  @Override String getMatcherInfo(); @Override void init(); @Override Collection<MailAddress> match(Mail mail); boolean isMarkedAsSpam(Mail mail, MailAddress recipient); }
IsMarkedAsSpam extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return mail.getRecipients() .stream() .filter(recipient -> isMarkedAsSpam(mail, recipient)) .collect(Guavate.toImmutableList()); }  @Override String getMatcherInfo(); @Override void init(); @Override Collection<MailAddress> match(Mail mail); boolean isMarkedAsSpam(Mail mail, MailAddress recipient);  }