@Test void eventShoudlDoNothingIfMailboxDoesNotHaveAnyAnnotation() throws Exception { when(annotationMapper.getAllAnnotations(any(MailboxId.class))).thenReturn(ImmutableList.<MailboxAnnotation>of()); listener.event(deleteEvent); verify(mailboxSessionMapperFactory).getAnnotationMapper(eq(mailboxSession)); verify(annotationMapper).getAllAnnotations(eq(mailboxId)); verifyNoMoreInteractions(mailboxSessionMapperFactory); verifyNoMoreInteractions(annotationMapper); }
@Override public void event(Event event) { if (event instanceof MailboxDeletion) { MailboxSession mailboxSession = sessionProvider.createSystemSession(event.getUsername()); AnnotationMapper annotationMapper = mailboxSessionMapperFactory.getAnnotationMapper(mailboxSession); MailboxId mailboxId = ((MailboxDeletion) event).getMailboxId(); deleteRelatedAnnotations(mailboxId, annotationMapper); } }
MailboxAnnotationListener implements MailboxListener.GroupMailboxListener { @Override public void event(Event event) { if (event instanceof MailboxDeletion) { MailboxSession mailboxSession = sessionProvider.createSystemSession(event.getUsername()); AnnotationMapper annotationMapper = mailboxSessionMapperFactory.getAnnotationMapper(mailboxSession); MailboxId mailboxId = ((MailboxDeletion) event).getMailboxId(); deleteRelatedAnnotations(mailboxId, annotationMapper); } } }
MailboxAnnotationListener implements MailboxListener.GroupMailboxListener { @Override public void event(Event event) { if (event instanceof MailboxDeletion) { MailboxSession mailboxSession = sessionProvider.createSystemSession(event.getUsername()); AnnotationMapper annotationMapper = mailboxSessionMapperFactory.getAnnotationMapper(mailboxSession); MailboxId mailboxId = ((MailboxDeletion) event).getMailboxId(); deleteRelatedAnnotations(mailboxId, annotationMapper); } } @Inject  MailboxAnnotationListener(MailboxSessionMapperFactory mailboxSessionMapperFactory, SessionProvider sessionProvider); }
MailboxAnnotationListener implements MailboxListener.GroupMailboxListener { @Override public void event(Event event) { if (event instanceof MailboxDeletion) { MailboxSession mailboxSession = sessionProvider.createSystemSession(event.getUsername()); AnnotationMapper annotationMapper = mailboxSessionMapperFactory.getAnnotationMapper(mailboxSession); MailboxId mailboxId = ((MailboxDeletion) event).getMailboxId(); deleteRelatedAnnotations(mailboxId, annotationMapper); } } @Inject  MailboxAnnotationListener(MailboxSessionMapperFactory mailboxSessionMapperFactory, SessionProvider sessionProvider); @Override Group getDefaultGroup(); @Override void event(Event event); }
MailboxAnnotationListener implements MailboxListener.GroupMailboxListener { @Override public void event(Event event) { if (event instanceof MailboxDeletion) { MailboxSession mailboxSession = sessionProvider.createSystemSession(event.getUsername()); AnnotationMapper annotationMapper = mailboxSessionMapperFactory.getAnnotationMapper(mailboxSession); MailboxId mailboxId = ((MailboxDeletion) event).getMailboxId(); deleteRelatedAnnotations(mailboxId, annotationMapper); } } @Inject  MailboxAnnotationListener(MailboxSessionMapperFactory mailboxSessionMapperFactory, SessionProvider sessionProvider); @Override Group getDefaultGroup(); @Override void event(Event event); static final Group GROUP; }