@Test public void shouldNotMatchWhenSubjectDoesntStartWithConfiguredValue() throws MessagingException { FakeMail mail = FakeMail.builder() .name("mail") .recipients(roger) .mimeMessage(MailUtil.createMimeMessageWithSubject("foobar")) .build(); FakeMatcherConfig mailetConfig = FakeMatcherConfig.builder() .matcherName("SubjectStartsWith") .condition("test") .build(); matcher.init(mailetConfig); assertThat(matcher.match(mail)).isNull(); }
@Override public Collection<MailAddress> match(Mail mail) throws MessagingException { MimeMessage mm = mail.getMessage(); String subject = mm.getSubject(); if (subject != null && subject.startsWith(getCondition())) { return mail.getRecipients(); } return null; }
SubjectStartsWith extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) throws MessagingException { MimeMessage mm = mail.getMessage(); String subject = mm.getSubject(); if (subject != null && subject.startsWith(getCondition())) { return mail.getRecipients(); } return null; } }
SubjectStartsWith extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) throws MessagingException { MimeMessage mm = mail.getMessage(); String subject = mm.getSubject(); if (subject != null && subject.startsWith(getCondition())) { return mail.getRecipients(); } return null; }  }
SubjectStartsWith extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) throws MessagingException { MimeMessage mm = mail.getMessage(); String subject = mm.getSubject(); if (subject != null && subject.startsWith(getCondition())) { return mail.getRecipients(); } return null; }  @Override Collection<MailAddress> match(Mail mail); }
SubjectStartsWith extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) throws MessagingException { MimeMessage mm = mail.getMessage(); String subject = mm.getSubject(); if (subject != null && subject.startsWith(getCondition())) { return mail.getRecipients(); } return null; }  @Override Collection<MailAddress> match(Mail mail);  }