Mono<Notification> createNotification(NotificationElement notificationElement) {
        var reason = notificationElement.reason();
        var subscriber = notificationElement.subscriber();
        return client.fetch(User.class, subscriber.name())
            .flatMap(user -> {
                Notification notification = new Notification();
                notification.setMetadata(new Metadata());
                notification.getMetadata().setGenerateName("notification-");
                notification.setSpec(new Notification.NotificationSpec());
                notification.getSpec().setTitle(notificationElement.notificationTitle());
                notification.getSpec().setRawContent(notificationElement.notificationRawBody());
                notification.getSpec().setHtmlContent(notificationElement.notificationHtmlBody);
                notification.getSpec().setRecipient(subscriber.name());
                notification.getSpec().setReason(reason.getMetadata().getName());
                notification.getSpec().setUnread(true);
                return client.create(notification);
            });
    }
@Test
    public void testCreateNotification() {
        var element = mock(DefaultNotificationCenter.NotificationElement.class);
        var subscription = createSubscriptions().get(0);
        var user = mock(User.class);

        var subscriptionName = subscription.getMetadata().getName();
        var subscriber =
            new Subscriber(UserIdentity.of(subscription.getSpec().getSubscriber().getName()),
                subscriptionName);
        when(client.fetch(eq(User.class), eq(subscriber.name()))).thenReturn(Mono.just(user));
        when(element.subscriber()).thenReturn(subscriber);

        when(client.create(any(Notification.class))).thenReturn(Mono.empty());

        var reason = new Reason();
        reason.setMetadata(new Metadata());
        reason.getMetadata().setName("reason-a");
        reason.setSpec(new Reason.Spec());
        reason.getSpec().setReasonType("new-reply-on-comment");
        when(element.reason()).thenReturn(reason);

        notificationCenter.createNotification(element).block();

        verify(client).fetch(eq(User.class), eq(subscriber.name()));
        verify(client).create(any(Notification.class));
    }