@Test public void initShouldThrowWhenSpamdPortIsNotNumber() { assertThatThrownBy(() -> mailet.init(FakeMailetConfig.builder() .mailetName("SpamAssassin") .setProperty(SpamAssassin.SPAMD_PORT, "noNumber") .build())).isInstanceOf(MessagingException.class); }
@Override public void init() throws MessagingException { spamdHost = Optional.ofNullable(getInitParameter(SPAMD_HOST)) .filter(Predicate.not(Strings::isNullOrEmpty)) .orElse(DEFAULT_HOST); spamdPort = MailetUtil.getInitParameterAsStrictlyPositiveInteger(getInitParameter(SPAMD_PORT), DEFAULT_PORT); Port.assertValid(spamdPort); }
SpamAssassin extends GenericMailet { @Override public void init() throws MessagingException { spamdHost = Optional.ofNullable(getInitParameter(SPAMD_HOST)) .filter(Predicate.not(Strings::isNullOrEmpty)) .orElse(DEFAULT_HOST); spamdPort = MailetUtil.getInitParameterAsStrictlyPositiveInteger(getInitParameter(SPAMD_PORT), DEFAULT_PORT); Port.assertValid(spamdPort); } }
SpamAssassin extends GenericMailet { @Override public void init() throws MessagingException { spamdHost = Optional.ofNullable(getInitParameter(SPAMD_HOST)) .filter(Predicate.not(Strings::isNullOrEmpty)) .orElse(DEFAULT_HOST); spamdPort = MailetUtil.getInitParameterAsStrictlyPositiveInteger(getInitParameter(SPAMD_PORT), DEFAULT_PORT); Port.assertValid(spamdPort); } @Inject  SpamAssassin(MetricFactory metricFactory, UsersRepository usersRepository); }
SpamAssassin extends GenericMailet { @Override public void init() throws MessagingException { spamdHost = Optional.ofNullable(getInitParameter(SPAMD_HOST)) .filter(Predicate.not(Strings::isNullOrEmpty)) .orElse(DEFAULT_HOST); spamdPort = MailetUtil.getInitParameterAsStrictlyPositiveInteger(getInitParameter(SPAMD_PORT), DEFAULT_PORT); Port.assertValid(spamdPort); } @Inject  SpamAssassin(MetricFactory metricFactory, UsersRepository usersRepository); @Override void init(); @Override void service(Mail mail); @Override String getMailetInfo(); }
SpamAssassin extends GenericMailet { @Override public void init() throws MessagingException { spamdHost = Optional.ofNullable(getInitParameter(SPAMD_HOST)) .filter(Predicate.not(Strings::isNullOrEmpty)) .orElse(DEFAULT_HOST); spamdPort = MailetUtil.getInitParameterAsStrictlyPositiveInteger(getInitParameter(SPAMD_PORT), DEFAULT_PORT); Port.assertValid(spamdPort); } @Inject  SpamAssassin(MetricFactory metricFactory, UsersRepository usersRepository); @Override void init(); @Override void service(Mail mail); @Override String getMailetInfo(); static final String SPAMD_HOST; static final String SPAMD_PORT; static final String DEFAULT_HOST; static final int DEFAULT_PORT; }