TooManyRecipients extends GenericMatcher { @Override public void init() throws MessagingException { maximumRecipientCount = MailetUtil.getInitParameterAsStrictlyPositiveInteger(getCondition()); }  @Override void init(); @Override Collection<MailAddress> match(Mail mail);  }
@Test void initShouldThrowOnAbsentCondition() { assertThatThrownBy(() -> testee.init(FakeMatcherConfig.builder() .matcherName("matcherName") .build())) .isInstanceOf(MessagingException.class); }
@Test void initShouldThrowOnInvalidCondition() { assertThatThrownBy(() -> testee.init(FakeMatcherConfig.builder() .condition("a") .matcherName("matcherName") .build())) .isInstanceOf(MessagingException.class); }
@Test void initShouldThrowOnEmptyCondition() { assertThatThrownBy(() -> testee.init(FakeMatcherConfig.builder() .condition("") .matcherName("matcherName") .build())) .isInstanceOf(MessagingException.class); }
@Test void initShouldThrowOnZeroCondition() { assertThatThrownBy(() -> testee.init(FakeMatcherConfig.builder() .condition("0") .matcherName("matcherName") .build())) .isInstanceOf(MessagingException.class); }
@Test void initShouldThrowOnNegativeCondition() { assertThatThrownBy(() -> testee.init(FakeMatcherConfig.builder() .condition("-10") .matcherName("matcherName") .build())) .isInstanceOf(MessagingException.class); }