private static boolean areTwoObjectsLooselyEqual(
            @Nullable Object actualValue,
            @Nullable Object expectedValue) {
        if (actualValue == null) {
            return null == expectedValue;
        } else if (expectedValue == null) {
            return false;
        }
        if (expectedValue.equals(actualValue)) {
            return true;
        }
        // For strings and primitives, check if their strings are equal
        if (expectedValue instanceof String
                || PrimitiveUtil.isPrimitiveOrWrapperClass(expectedValue.getClass())) {
            return (actualValue instanceof String
                    || PrimitiveUtil.isPrimitiveOrWrapperClass(actualValue.getClass()))
                    && expectedValue.toString()
                            .equals(actualValue.toString());
        }
        if (expectedValue.getClass()
                .isArray()) {
            // Compare for arrays and collections
            return areCollectionsLooselyEqual(ArrayUtil.getArray(expectedValue), actualValue);
        } else if (expectedValue instanceof Collection<?> expectedValueCollection) {
            // Compare for arrays and collections
            return areCollectionsLooselyEqual(expectedValueCollection, actualValue);
        } else if (expectedValue instanceof Map<?, ?> expectedValueMap) {
            // Compare for maps
            return actualValue instanceof Map<?, ?> actualValueMap
                    && containsAllLooseComparison(actualValueMap, expectedValueMap);
        }
        return false;
    }
Note that the method only checks the immutable classes used by Turms.
turms-server-common/src/main/java/im/turms/server/common/infra/collection/CollectionUtil.java