@Test public void scanMailShouldModifyRequiredHitsField() throws Exception { MimeMessage mimeMessage = MimeMessageUtil.mimeMessageFromStream( ClassLoader.getSystemResourceAsStream("eml/spam.eml")); SpamAssassinResult result = testee.scanMail(mimeMessage, USERNAME); assertThat(result.getRequiredHits()).isEqualTo("5.0"); }
public SpamAssassinResult scanMail(MimeMessage message, Username username) throws MessagingException { return metricFactory.decorateSupplierWithTimerMetric( "spamAssassin-check", Throwing.supplier( () -> scanMailWithAdditionalHeaders(message, "User: " + username.asString())) .sneakyThrow()); }
SpamAssassinInvoker { public SpamAssassinResult scanMail(MimeMessage message, Username username) throws MessagingException { return metricFactory.decorateSupplierWithTimerMetric( "spamAssassin-check", Throwing.supplier( () -> scanMailWithAdditionalHeaders(message, "User: " + username.asString())) .sneakyThrow()); } }
SpamAssassinInvoker { public SpamAssassinResult scanMail(MimeMessage message, Username username) throws MessagingException { return metricFactory.decorateSupplierWithTimerMetric( "spamAssassin-check", Throwing.supplier( () -> scanMailWithAdditionalHeaders(message, "User: " + username.asString())) .sneakyThrow()); } SpamAssassinInvoker(MetricFactory metricFactory, String spamdHost, int spamdPort); }
SpamAssassinInvoker { public SpamAssassinResult scanMail(MimeMessage message, Username username) throws MessagingException { return metricFactory.decorateSupplierWithTimerMetric( "spamAssassin-check", Throwing.supplier( () -> scanMailWithAdditionalHeaders(message, "User: " + username.asString())) .sneakyThrow()); } SpamAssassinInvoker(MetricFactory metricFactory, String spamdHost, int spamdPort); SpamAssassinResult scanMail(MimeMessage message, Username username); SpamAssassinResult scanMail(MimeMessage message); boolean learnAsSpam(InputStream message, Username username); boolean learnAsHam(InputStream message, Username username); }
SpamAssassinInvoker { public SpamAssassinResult scanMail(MimeMessage message, Username username) throws MessagingException { return metricFactory.decorateSupplierWithTimerMetric( "spamAssassin-check", Throwing.supplier( () -> scanMailWithAdditionalHeaders(message, "User: " + username.asString())) .sneakyThrow()); } SpamAssassinInvoker(MetricFactory metricFactory, String spamdHost, int spamdPort); SpamAssassinResult scanMail(MimeMessage message, Username username); SpamAssassinResult scanMail(MimeMessage message); boolean learnAsSpam(InputStream message, Username username); boolean learnAsHam(InputStream message, Username username);  }