@Test void isEventOnSpamMailboxShouldReturnTrueWhenMailboxIsSpam() { MessageMoveEvent messageMoveEvent = MessageMoveEvent.builder() .session(MAILBOX_SESSION) .messageMoves(MessageMoves.builder() .previousMailboxIds(mailboxId1) .targetMailboxIds(spamMailboxId) .build()) .messageId(MESSAGE_ID) .build(); assertThat(listener.isMessageMovedToSpamMailbox(messageMoveEvent)).isTrue(); }
@VisibleForTesting boolean isMessageMovedToSpamMailbox(MessageMoveEvent event) { try { MailboxId spamMailboxId = systemMailboxesProvider.findMailbox(Role.SPAM, event.getUsername()).getId(); return event.getMessageMoves().addedMailboxIds().contains(spamMailboxId); } catch (MailboxException e) { LOGGER.warn("Could not resolve Spam mailbox", e); return false; } }
SpamAssassinListener implements SpamEventListener { @VisibleForTesting boolean isMessageMovedToSpamMailbox(MessageMoveEvent event) { try { MailboxId spamMailboxId = systemMailboxesProvider.findMailbox(Role.SPAM, event.getUsername()).getId(); return event.getMessageMoves().addedMailboxIds().contains(spamMailboxId); } catch (MailboxException e) { LOGGER.warn("Could not resolve Spam mailbox", e); return false; } } }
SpamAssassinListener implements SpamEventListener { @VisibleForTesting boolean isMessageMovedToSpamMailbox(MessageMoveEvent event) { try { MailboxId spamMailboxId = systemMailboxesProvider.findMailbox(Role.SPAM, event.getUsername()).getId(); return event.getMessageMoves().addedMailboxIds().contains(spamMailboxId); } catch (MailboxException e) { LOGGER.warn("Could not resolve Spam mailbox", e); return false; } } @Inject  SpamAssassinListener(SpamAssassin spamAssassin, SystemMailboxesProvider systemMailboxesProvider, MailboxManager mailboxManager, MailboxSessionMapperFactory mapperFactory, ExecutionMode executionMode); }
SpamAssassinListener implements SpamEventListener { @VisibleForTesting boolean isMessageMovedToSpamMailbox(MessageMoveEvent event) { try { MailboxId spamMailboxId = systemMailboxesProvider.findMailbox(Role.SPAM, event.getUsername()).getId(); return event.getMessageMoves().addedMailboxIds().contains(spamMailboxId); } catch (MailboxException e) { LOGGER.warn("Could not resolve Spam mailbox", e); return false; } } @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 { @VisibleForTesting boolean isMessageMovedToSpamMailbox(MessageMoveEvent event) { try { MailboxId spamMailboxId = systemMailboxesProvider.findMailbox(Role.SPAM, event.getUsername()).getId(); return event.getMessageMoves().addedMailboxIds().contains(spamMailboxId); } catch (MailboxException e) { LOGGER.warn("Could not resolve Spam mailbox", e); return false; } } @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);  }