From 6f9b5c010df77812a0acff6c28c9bfaa86f3e118 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Tue, 19 Jul 2022 13:49:21 +0200 Subject: [PATCH] Deletes migration test --- .../migration/MigrateSessionTo033Test.kt | 36 --------------- .../sdk/test/fakes/FakeDynamicRealm.kt | 30 ------------ .../sdk/test/fakes/FakeDynamicRealmObject.kt | 33 ------------- .../sdk/test/fakes/FakeRealmObjectSchema.kt | 46 ------------------- .../android/sdk/test/fakes/FakeRealmSchema.kt | 36 --------------- 5 files changed, 181 deletions(-) delete mode 100644 matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo033Test.kt delete mode 100644 matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeDynamicRealm.kt delete mode 100644 matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeDynamicRealmObject.kt delete mode 100644 matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeRealmObjectSchema.kt delete mode 100644 matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeRealmSchema.kt diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo033Test.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo033Test.kt deleted file mode 100644 index 5e994b2209..0000000000 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo033Test.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2022 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.matrix.android.sdk.internal.database.migration - -import org.junit.Test -import org.matrix.android.sdk.internal.database.model.RoomSummaryEntityFields -import org.matrix.android.sdk.test.fakes.FakeDynamicRealm - -internal class MigrateSessionTo033Test { - - private val fakeDynamicRealm = FakeDynamicRealm() - private val migrator = MigrateSessionTo033(fakeDynamicRealm.instance) - - @Test - fun `when doMigrate, then directParentNames added`() { - migrator.doMigrate(fakeDynamicRealm.instance) - - fakeDynamicRealm.fakeRealmSchema.withObjectSchema("RoomSummaryEntity") - .verifyListFieldAdded(RoomSummaryEntityFields.DIRECT_PARENT_NAMES.`$`, String::class.java) - .verifyStringTransformation(RoomSummaryEntityFields.DIRECT_PARENT_NAMES.`$`, "") - } -} diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeDynamicRealm.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeDynamicRealm.kt deleted file mode 100644 index 9292d6466e..0000000000 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeDynamicRealm.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2022 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.matrix.android.sdk.test.fakes - -import io.mockk.every -import io.mockk.mockk -import io.realm.DynamicRealm - -class FakeDynamicRealm( - val fakeRealmSchema: FakeRealmSchema = FakeRealmSchema() -) { - - val instance: DynamicRealm = mockk { - every { schema } returns fakeRealmSchema.instance - } -} diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeDynamicRealmObject.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeDynamicRealmObject.kt deleted file mode 100644 index 50bbe8c71d..0000000000 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeDynamicRealmObject.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2022 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.matrix.android.sdk.test.fakes - -import io.mockk.justRun -import io.mockk.mockk -import io.mockk.verify -import io.realm.DynamicRealmObject - -class FakeDynamicRealmObject { - - val instance: DynamicRealmObject = mockk { - justRun { setString(any(), any()) } - } - - fun verifySetString(fieldName: String, value: String) { - verify { instance.setString(fieldName, value) } - } -} diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeRealmObjectSchema.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeRealmObjectSchema.kt deleted file mode 100644 index da93d88041..0000000000 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeRealmObjectSchema.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2022 The Matrix.org Foundation C.I.C. - * Copyright 2022 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.matrix.android.sdk.test.fakes - -import io.mockk.every -import io.mockk.mockk -import io.mockk.slot -import io.mockk.verify -import io.realm.RealmObjectSchema -import io.realm.RealmObjectSchema.Function - -class FakeRealmObjectSchema( - private val fakeDynamicRealmObject: FakeDynamicRealmObject = FakeDynamicRealmObject() -) { - - val instance: RealmObjectSchema = mockk { - every { addRealmListField(any(), any>()) } returns this - every { transform(any()) } returns this - } - - fun verifyListFieldAdded(fieldName: String, type: Class<*>) = apply { - verify { instance.addRealmListField(fieldName, type) } - } - - fun verifyStringTransformation(fieldName: String, transformedInto: String) = apply { - val transformationSlot = slot() - verify { instance.transform(capture(transformationSlot)) } - transformationSlot.captured.apply(fakeDynamicRealmObject.instance) - fakeDynamicRealmObject.verifySetString(fieldName, transformedInto) - } -} diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeRealmSchema.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeRealmSchema.kt deleted file mode 100644 index 84ccd61857..0000000000 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeRealmSchema.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2022 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.matrix.android.sdk.test.fakes - -import io.mockk.every -import io.mockk.mockk -import io.mockk.verify -import io.realm.RealmSchema - -class FakeRealmSchema( - private val fakeRealmObjectSchema: FakeRealmObjectSchema = FakeRealmObjectSchema() -) { - - val instance: RealmSchema = mockk { - every { this@mockk.get(any()) } returns fakeRealmObjectSchema.instance - } - - fun withObjectSchema(className: String): FakeRealmObjectSchema { - verify { instance.get(className) } - return fakeRealmObjectSchema - } -}