@Test public void filterShouldNotTryToAddUserWhenReadOnlyUsersRepository() { UsersRepository usersRepository = mock(UsersRepository.class); when(usersRepository.isReadOnly()).thenReturn(true); testee = new UserProvisioner(usersRepository, new RecordingMetricFactory()); MailboxSession mailboxSession = MailboxSessionUtil.create(USERNAME_WITH_DOMAIN); testee.provisionUser(mailboxSession).block(); verify(usersRepository).isReadOnly(); verifyNoMoreInteractions(usersRepository); }
public Mono<Void> provisionUser(MailboxSession session) { if (session != null && !usersRepository.isReadOnly()) { return Mono.fromRunnable(() -> createAccountIfNeeded(session)); } return Mono.empty(); }
UserProvisioner { public Mono<Void> provisionUser(MailboxSession session) { if (session != null && !usersRepository.isReadOnly()) { return Mono.fromRunnable(() -> createAccountIfNeeded(session)); } return Mono.empty(); } }
UserProvisioner { public Mono<Void> provisionUser(MailboxSession session) { if (session != null && !usersRepository.isReadOnly()) { return Mono.fromRunnable(() -> createAccountIfNeeded(session)); } return Mono.empty(); } @Inject @VisibleForTesting  UserProvisioner(UsersRepository usersRepository, MetricFactory metricFactory); }
UserProvisioner { public Mono<Void> provisionUser(MailboxSession session) { if (session != null && !usersRepository.isReadOnly()) { return Mono.fromRunnable(() -> createAccountIfNeeded(session)); } return Mono.empty(); } @Inject @VisibleForTesting  UserProvisioner(UsersRepository usersRepository, MetricFactory metricFactory); Mono<Void> provisionUser(MailboxSession session); }
UserProvisioner { public Mono<Void> provisionUser(MailboxSession session) { if (session != null && !usersRepository.isReadOnly()) { return Mono.fromRunnable(() -> createAccountIfNeeded(session)); } return Mono.empty(); } @Inject @VisibleForTesting  UserProvisioner(UsersRepository usersRepository, MetricFactory metricFactory); Mono<Void> provisionUser(MailboxSession session);  }