@Test void eventShouldCallSpamAssassinSpamLearningWhenTheEventMatches() throws Exception { MessageMoveEvent messageMoveEvent = MessageMoveEvent.builder() .session(MAILBOX_SESSION) .messageMoves(MessageMoves.builder() .previousMailboxIds(mailboxId1) .targetMailboxIds(spamMailboxId) .build()) .messageId(MESSAGE_ID) .build(); listener.event(messageMoveEvent); verify(spamAssassin).learnSpam(any(), any()); }
@Override public void event(Event event) throws MailboxException { Username username = Username.of(getClass().getCanonicalName()); if (event instanceof MessageMoveEvent) { MailboxSession session = mailboxManager.createSystemSession(username); handleMessageMove(event, session, (MessageMoveEvent) event); } if (event instanceof Added) { MailboxSession session = mailboxManager.createSystemSession(username); handleAdded(event, session, (Added) event); } }
SpamAssassinListener implements SpamEventListener { @Override public void event(Event event) throws MailboxException { Username username = Username.of(getClass().getCanonicalName()); if (event instanceof MessageMoveEvent) { MailboxSession session = mailboxManager.createSystemSession(username); handleMessageMove(event, session, (MessageMoveEvent) event); } if (event instanceof Added) { MailboxSession session = mailboxManager.createSystemSession(username); handleAdded(event, session, (Added) event); } } }
SpamAssassinListener implements SpamEventListener { @Override public void event(Event event) throws MailboxException { Username username = Username.of(getClass().getCanonicalName()); if (event instanceof MessageMoveEvent) { MailboxSession session = mailboxManager.createSystemSession(username); handleMessageMove(event, session, (MessageMoveEvent) event); } if (event instanceof Added) { MailboxSession session = mailboxManager.createSystemSession(username); handleAdded(event, session, (Added) event); } } @Inject  SpamAssassinListener(SpamAssassin spamAssassin, SystemMailboxesProvider systemMailboxesProvider, MailboxManager mailboxManager, MailboxSessionMapperFactory mapperFactory, ExecutionMode executionMode); }
SpamAssassinListener implements SpamEventListener { @Override public void event(Event event) throws MailboxException { Username username = Username.of(getClass().getCanonicalName()); if (event instanceof MessageMoveEvent) { MailboxSession session = mailboxManager.createSystemSession(username); handleMessageMove(event, session, (MessageMoveEvent) event); } if (event instanceof Added) { MailboxSession session = mailboxManager.createSystemSession(username); handleAdded(event, session, (Added) event); } } @Inject  SpamAssassinListener(SpamAssassin spamAssassin, SystemMailboxesProvider systemMailboxesProvider, MailboxManager mailboxManager, MailboxSessionMapperFactory mapperFactory, ExecutionMode executionMode); @Override Group getDefaultGroup(); @Override ExecutionMode getExecutionMode(); @Override boolean isHandling(Event event); @Override void event(Event event); }
SpamAssassinListener implements SpamEventListener { @Override public void event(Event event) throws MailboxException { Username username = Username.of(getClass().getCanonicalName()); if (event instanceof MessageMoveEvent) { MailboxSession session = mailboxManager.createSystemSession(username); handleMessageMove(event, session, (MessageMoveEvent) event); } if (event instanceof Added) { MailboxSession session = mailboxManager.createSystemSession(username); handleAdded(event, session, (Added) event); } } @Inject  SpamAssassinListener(SpamAssassin spamAssassin, SystemMailboxesProvider systemMailboxesProvider, MailboxManager mailboxManager, MailboxSessionMapperFactory mapperFactory, ExecutionMode executionMode); @Override Group getDefaultGroup(); @Override ExecutionMode getExecutionMode(); @Override boolean isHandling(Event event); @Override void event(Event event);  }