public static UserVo from(User user) {
        User.UserStatus statusCopy =
            JsonUtils.deepCopy(ObjectUtils.defaultIfNull(user.getStatus(), new User.UserStatus()));
        statusCopy.setLoginHistories(List.of());
        statusCopy.setLastLoginAt(null);

        User.UserSpec userSpecCopy = JsonUtils.deepCopy(user.getSpec());
        userSpecCopy.setPassword("[PROTECTED]");
        return UserVo.builder()
            .metadata(user.getMetadata())
            .spec(userSpecCopy)
            .status(statusCopy)
            .build();
    }
@Test
    void from() throws JSONException {
        User user = new User();
        user.setMetadata(new Metadata());
        user.getMetadata().setName("fake-user");
        user.setSpec(new User.UserSpec());
        user.getSpec().setPassword("123456");
        user.getSpec().setEmail("example@example.com");
        user.getSpec().setAvatar("avatar");
        user.getSpec().setDisplayName("fake-user-display-name");
        user.getSpec().setBio("user bio");
        user.getSpec().setDisabled(false);
        user.getSpec().setPhone("123456789");
        user.getSpec().setRegisteredAt(Instant.parse("2022-01-01T00:00:00.00Z"));
        user.getSpec().setLoginHistoryLimit(5);
        user.getSpec().setTwoFactorAuthEnabled(false);

        user.setStatus(new User.UserStatus());
        user.getStatus().setLastLoginAt(Instant.parse("2022-01-02T00:00:00.00Z"));
        User.LoginHistory loginHistory = new User.LoginHistory();
        loginHistory.setLoginAt(Instant.parse("2022-01-02T00:00:00.00Z"));
        loginHistory.setReason("login reason");
        loginHistory.setUserAgent("user agent");
        user.getStatus().setLoginHistories(List.of(loginHistory));

        UserVo userVo = UserVo.from(user);
        JSONAssert.assertEquals("""
                {
                    "metadata": {
                        "name": "fake-user"
                    },
                    "spec": {
                        "displayName": "fake-user-display-name",
                        "avatar": "avatar",
                        "email": "example@example.com",
                        "emailVerified": false,
                        "phone": "123456789",
                        "password": "[PROTECTED]",
                        "bio": "user bio",
                        "registeredAt": "2022-01-01T00:00:00Z",
                        "twoFactorAuthEnabled": false,
                        "disabled": false,
                        "loginHistoryLimit": 5
                    },
                    "status": {
                        "loginHistories": []
                    }
                }
                """,
            JsonUtils.objectToJson(userVo),
            true);
    }