@Override
    public JsonObject toJson() {
        JsonObject root = new JsonObject();
        root.add("clusterState", clusterState.name());
        root.add("nodeState", nodeState.name());
        root.add("clusterVersion", clusterVersion.toString());
        root.add("memberVersion", memberVersion.toString());

        JsonObject weaknesses = new JsonObject();
        for (Map.Entry<String, List<String>> entry : weakSecretsConfigs.entrySet()) {
            JsonArray values = new JsonArray();
            for (String value : entry.getValue()) {
                values.add(value);
            }
            weaknesses.add(entry.getKey(), values);
        }
        root.add("weakConfigs", weaknesses);
        return root;
    }
@Test
    public void toJson() throws Exception {
        ClusterState clusterState = ClusterState.ACTIVE;
        com.hazelcast.instance.impl.NodeState nodeState = com.hazelcast.instance.impl.NodeState.PASSIVE;
        Version clusterVersion = Version.of("3.8");
        MemberVersion memberVersion = MemberVersion.of("3.9.0");

        NodeState state = new NodeStateImpl(clusterState, nodeState, clusterVersion, memberVersion);
        NodeState deserialized = new NodeStateImpl();
        deserialized.fromJson(state.toJson());

        assertEquals(clusterState, deserialized.getClusterState());
        assertEquals(nodeState, deserialized.getNodeState());
        assertEquals(clusterVersion, deserialized.getClusterVersion());
        assertEquals(memberVersion, deserialized.getMemberVersion());
    }