@Override
    public Mono<UserNotificationPreference> getByUser(String username) {
        var configName = buildUserPreferenceConfigMapName(username);
        return client.fetch(ConfigMap.class, configName)
            .map(config -> {
                if (config.getData() == null) {
                    return new UserNotificationPreference();
                }
                String s = config.getData().get(NOTIFICATION_PREFERENCE);
                if (StringUtils.isNotBlank(s)) {
                    return JsonUtils.jsonToObject(s, UserNotificationPreference.class);
                }
                return new UserNotificationPreference();
            })
            .defaultIfEmpty(new UserNotificationPreference());
    }
@Test
    void getByUser() {
        var configMap = new ConfigMap();
        configMap.setData(Map.of("notification",
            "{\"reasonTypeNotifier\":{\"comment\":{\"notifiers\":[\"test-notifier\"]}}}"));
        when(client.fetch(ConfigMap.class, "user-preferences-guqing"))
            .thenReturn(Mono.just(configMap));
        userNotificationPreferenceService.getByUser("guqing")
            .as(StepVerifier::create)
            .consumeNextWith(preference -> {
                assertThat(preference.getReasonTypeNotifier()).isNotNull();
                assertThat(preference.getReasonTypeNotifier().get("comment")).isNotNull();
                assertThat(preference.getReasonTypeNotifier().get("comment").getNotifiers())
                    .containsExactly("test-notifier");
            })
            .verifyComplete();

        verify(client).fetch(ConfigMap.class, "user-preferences-guqing");
    }