@Disabled("MAILBOX-377 This test is not stable, fails on our CI and thus is temporarily disabled") @Test public void scanMailShouldMarkAsSpamWhenKnownAsSpam() throws Exception { spamAssassin.train("user"); MimeMessage mimeMessage = MimeMessageUtil.mimeMessageFromStream( ClassLoader.getSystemResourceAsStream("spamassassin_db/spam/spam1")); SpamAssassinResult result = testee.scanMail(mimeMessage, USERNAME); assertThat(result.getHeadersAsAttributes()).contains(new Attribute(SpamAssassinResult.FLAG_MAIL, AttributeValue.of("YES"))); }
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);  }