@Test void matchShouldReturnEmptyWhenNoRecipient() throws Exception { Dlp dlp = new Dlp(MATCH_ALL_FOR_ALL_DOMAINS); FakeMail mail = FakeMail.builder().name("name").sender(RECIPIENT1).build(); assertThat(dlp.match(mail)).isEmpty(); }
@Override public Collection<MailAddress> match(Mail mail) { Optional<DLPConfigurationItem.Id> firstMatchingRuleId = findFirstMatchingRule(mail); if (firstMatchingRuleId.isPresent()) { DLPConfigurationItem.Id ruleId = firstMatchingRuleId.get(); setRuleIdAsMailAttribute(mail, ruleId); return mail.getRecipients(); } return ImmutableList.of(); }
Dlp extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { Optional<DLPConfigurationItem.Id> firstMatchingRuleId = findFirstMatchingRule(mail); if (firstMatchingRuleId.isPresent()) { DLPConfigurationItem.Id ruleId = firstMatchingRuleId.get(); setRuleIdAsMailAttribute(mail, ruleId); return mail.getRecipients(); } return ImmutableList.of(); } }
Dlp extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { Optional<DLPConfigurationItem.Id> firstMatchingRuleId = findFirstMatchingRule(mail); if (firstMatchingRuleId.isPresent()) { DLPConfigurationItem.Id ruleId = firstMatchingRuleId.get(); setRuleIdAsMailAttribute(mail, ruleId); return mail.getRecipients(); } return ImmutableList.of(); } @VisibleForTesting  Dlp(DlpRulesLoader rulesLoader); @Inject  Dlp(DLPConfigurationStore configurationStore); }
Dlp extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { Optional<DLPConfigurationItem.Id> firstMatchingRuleId = findFirstMatchingRule(mail); if (firstMatchingRuleId.isPresent()) { DLPConfigurationItem.Id ruleId = firstMatchingRuleId.get(); setRuleIdAsMailAttribute(mail, ruleId); return mail.getRecipients(); } return ImmutableList.of(); } @VisibleForTesting  Dlp(DlpRulesLoader rulesLoader); @Inject  Dlp(DLPConfigurationStore configurationStore); @Override Collection<MailAddress> match(Mail mail); @Override String getMatcherInfo(); }
Dlp extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { Optional<DLPConfigurationItem.Id> firstMatchingRuleId = findFirstMatchingRule(mail); if (firstMatchingRuleId.isPresent()) { DLPConfigurationItem.Id ruleId = firstMatchingRuleId.get(); setRuleIdAsMailAttribute(mail, ruleId); return mail.getRecipients(); } return ImmutableList.of(); } @VisibleForTesting  Dlp(DlpRulesLoader rulesLoader); @Inject  Dlp(DLPConfigurationStore configurationStore); @Override Collection<MailAddress> match(Mail mail); @Override String getMatcherInfo();  }