private Mono<ServerResponse> initialize(ServerRequest request) {
        return request.bodyToMono(SystemInitializationRequest.class)
            .switchIfEmpty(
                Mono.error(new ServerWebInputException("Request body must not be empty"))
            )
            .doOnNext(requestBody -> {
                if (!ValidationUtils.validateName(requestBody.getUsername())) {
                    throw new UnsatisfiedAttributeValueException(
                        "The username does not meet the specifications",
                        "problemDetail.user.username.unsatisfied", null);
                }
                if (StringUtils.isBlank(requestBody.getPassword())) {
                    throw new UnsatisfiedAttributeValueException(
                        "The password does not meet the specifications",
                        "problemDetail.user.password.unsatisfied", null);
                }
            })
            .flatMap(requestBody -> initializationStateSupplier.userInitialized()
                .flatMap(result -> {
                    if (result) {
                        return Mono.error(new ResponseStatusException(HttpStatus.CONFLICT,
                            "System has been initialized"));
                    }
                    return initializeSystem(requestBody);
                })
            )
            .then(ServerResponse.created(URI.create("/console")).build());
    }
@Test
    void initializeWithRequestBody() {
        var initialization = new SystemInitializationRequest();
        initialization.setUsername("faker");
        initialization.setPassword("openfaker");
        initialization.setEmail("faker@halo.run");
        initialization.setSiteTitle("Fake Site");

        when(initializationStateGetter.userInitialized()).thenReturn(Mono.just(false));
        when(superAdminInitializer.initialize(any(InitializationParam.class)))
            .thenReturn(Mono.empty());

        var configMap = new ConfigMap();
        when(client.get(ConfigMap.class, SystemSetting.SYSTEM_CONFIG))
            .thenReturn(Mono.just(configMap));
        when(client.update(configMap)).thenReturn(Mono.just(configMap));

        webTestClient.post().uri("/system/initialize")
            .bodyValue(initialization)
            .exchange()
            .expectStatus().isCreated()
            .expectHeader().location("/console");

        verify(initializationStateGetter).userInitialized();
        verify(superAdminInitializer).initialize(any());
        verify(client).get(ConfigMap.class, SystemSetting.SYSTEM_CONFIG);
        verify(client).update(configMap);
    }