@Override
    public Mono<Void> notify(Reason reason) {
        return recipientResolver.resolve(reason)
            .doOnNext(subscriber -> {
                log.debug("Dispatching notification to subscriber [{}] for reason [{}]",
                    subscriber, reason.getMetadata().getName());
            })
            .publishOn(Schedulers.boundedElastic())
            .flatMap(subscriber -> dispatchNotification(reason, subscriber))
            .then();
    }
@Test
    public void testNotify() {
        final Reason reason = new Reason();
        final Reason.Spec spec = new Reason.Spec();
        Reason.Subject subject = new Reason.Subject();
        subject.setApiVersion("content.halo.run/v1alpha1");
        subject.setKind("Comment");
        subject.setName("comment-a");
        spec.setSubject(subject);
        spec.setReasonType("new-reply-on-comment");
        spec.setAttributes(null);
        reason.setSpec(spec);
        reason.setMetadata(new Metadata());
        reason.getMetadata().setName("reason-a");

        var spyNotificationCenter = spy(notificationCenter);
        var subscriber = new Subscriber(UserIdentity.anonymousWithEmail("A"), "fake-name");
        when(recipientResolver.resolve(reason)).thenReturn(Flux.just(subscriber));

        doReturn(Mono.empty()).when(spyNotificationCenter)
            .dispatchNotification(eq(reason), any());

        spyNotificationCenter.notify(reason).block();

        verify(spyNotificationCenter).dispatchNotification(eq(reason), any());
        verify(recipientResolver).resolve(eq(reason));
    }