@Override
    public Mono<String> resolve(Subscription.Subscriber subscriber) {
        var identity = UserIdentity.of(subscriber.getName());
        if (identity.isAnonymous()) {
            return Mono.fromSupplier(() -> getEmail(subscriber));
        }
        return client.fetch(User.class, subscriber.getName())
            .filter(user -> user.getSpec().isEmailVerified())
            .mapNotNull(user -> user.getSpec().getEmail());
    }
@Test
    void testResolve() {
        var subscriber = new Subscription.Subscriber();
        subscriber.setName(AnonymousUserConst.PRINCIPAL + "#test@example.com");
        subscriberEmailResolver.resolve(subscriber)
            .as(StepVerifier::create)
            .expectNext("test@example.com")
            .verifyComplete();

        subscriber.setName(AnonymousUserConst.PRINCIPAL + "#");
        subscriberEmailResolver.resolve(subscriber)
            .as(StepVerifier::create)
            .verifyErrorMessage("The subscriber does not have an email");

        var user = new User();
        user.setMetadata(new Metadata());
        user.getMetadata().setName("fake-user");
        user.setSpec(new User.UserSpec());
        user.getSpec().setEmail("test@halo.run");
        user.getSpec().setEmailVerified(false);
        when(client.fetch(eq(User.class), eq("fake-user"))).thenReturn(Mono.just(user));

        subscriber.setName("fake-user");
        subscriberEmailResolver.resolve(subscriber)
            .as(StepVerifier::create)
            .verifyComplete();

        user.getSpec().setEmailVerified(true);
        when(client.fetch(eq(User.class), eq("fake-user"))).thenReturn(Mono.just(user));

        subscriber.setName("fake-user");
        subscriberEmailResolver.resolve(subscriber)
            .as(StepVerifier::create)
            .expectNext("test@halo.run")
            .verifyComplete();
    }