From 3746d9a9f09bd5a92ddecc27dfec6ef4227c11f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Mon, 7 Aug 2023 14:16:41 +0200 Subject: [PATCH] Test of nullability of private properties --- .../src/androidTest/kotlin/io/realm/KotlinSchemaTests.kt | 3 +++ .../kotlin/io/realm/mongodb/sync/SyncedRealmTests.kt | 2 ++ .../src/testUtils/kotlin/io/realm/entities/AllKotlinTypes.kt | 3 +++ 3 files changed, 8 insertions(+) diff --git a/realm/realm-library/src/androidTest/kotlin/io/realm/KotlinSchemaTests.kt b/realm/realm-library/src/androidTest/kotlin/io/realm/KotlinSchemaTests.kt index 586d840f47..3579328b73 100644 --- a/realm/realm-library/src/androidTest/kotlin/io/realm/KotlinSchemaTests.kt +++ b/realm/realm-library/src/androidTest/kotlin/io/realm/KotlinSchemaTests.kt @@ -64,6 +64,8 @@ class KotlinSchemaTests { // We cannot enforce this constraint inside the schema right now. // If people maintain the variant themselves they need a custom getter // assertTrue(objSchema.isNullable(AllKotlinTypes::nonNullObject.name)); + + assertFalse(objSchema.isNullable("privateNonNullString")); } @Test @@ -81,6 +83,7 @@ class KotlinSchemaTests { assertTrue(objSchema.isNullable(AllKotlinTypes::nullFloat.name)); assertFalse(objSchema.isNullable(AllKotlinTypes::nullList.name)); // Managed realm objects do not allow null lists assertTrue(objSchema.isNullable(AllKotlinTypes::nullObject.name)); + assertTrue(objSchema.isNullable("privateNullString")); } } diff --git a/realm/realm-library/src/androidTestObjectServer/kotlin/io/realm/mongodb/sync/SyncedRealmTests.kt b/realm/realm-library/src/androidTestObjectServer/kotlin/io/realm/mongodb/sync/SyncedRealmTests.kt index 65c3469fd5..1c679f3dfa 100644 --- a/realm/realm-library/src/androidTestObjectServer/kotlin/io/realm/mongodb/sync/SyncedRealmTests.kt +++ b/realm/realm-library/src/androidTestObjectServer/kotlin/io/realm/mongodb/sync/SyncedRealmTests.kt @@ -788,8 +788,10 @@ class SyncedRealmTests { RealmFieldType.TYPED_LINK, // Not an actual exposed type, it is used internally by RealmAny RealmFieldType.FLOAT, // Float is not cloud compatible yet RealmFieldType.FLOAT_LIST, // Float is not cloud compatible yet + RealmFieldType.FLOAT_SET, RealmFieldType.STRING_TO_FLOAT_MAP // Float is not cloud compatible yet -> {} + } } } diff --git a/realm/realm-library/src/testUtils/kotlin/io/realm/entities/AllKotlinTypes.kt b/realm/realm-library/src/testUtils/kotlin/io/realm/entities/AllKotlinTypes.kt index f205392aea..b4712522ec 100644 --- a/realm/realm-library/src/testUtils/kotlin/io/realm/entities/AllKotlinTypes.kt +++ b/realm/realm-library/src/testUtils/kotlin/io/realm/entities/AllKotlinTypes.kt @@ -84,6 +84,9 @@ open class AllKotlinTypes : RealmObject() { @LinkingObjects("nonNullList") val listParents: RealmResults? = null; + + private var privateNonNullString: String = ""; + private var privateNullString: String? = ""; } open class WithRealmAnyTestEntity(