From 8d54a0d759c3b069ec904c3284f548b0ac20da31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Mart=C3=ADn?= Date: Tue, 4 Oct 2022 13:58:17 +0200 Subject: [PATCH] Remove Robolectric, make Robolectric test an instrumentation test --- dependencies.gradle | 1 - dependencies_groups.gradle | 1 - vector/build.gradle | 1 - .../features/RoomMemberListControllerTest.kt | 18 +++++------------- 4 files changed, 5 insertions(+), 16 deletions(-) rename vector/src/{test => androidTest}/java/im/vector/app/features/RoomMemberListControllerTest.kt (92%) diff --git a/dependencies.gradle b/dependencies.gradle index f5d64a78d1..6b2e62245c 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -168,7 +168,6 @@ ext.libs = [ 'kluent' : "org.amshove.kluent:kluent-android:1.68", 'timberJunitRule' : "net.lachlanmckee:timber-junit-rule:1.0.1", 'junit' : "junit:junit:4.13.2", - 'robolectric' : "org.robolectric:robolectric:4.8", ] ] diff --git a/dependencies_groups.gradle b/dependencies_groups.gradle index a97d80bc7f..149a1fbac5 100644 --- a/dependencies_groups.gradle +++ b/dependencies_groups.gradle @@ -210,7 +210,6 @@ ext.groups = [ 'org.ow2.asm', 'org.ow2.asm', 'org.reactivestreams', - 'org.robolectric', 'org.slf4j', 'org.sonatype.oss', 'org.testng', diff --git a/vector/build.gradle b/vector/build.gradle index 7bc97b1a57..763d968642 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -290,7 +290,6 @@ dependencies { testImplementation libs.tests.kluent testImplementation libs.mockk.mockk testImplementation libs.androidx.coreTesting - testImplementation libs.tests.robolectric // Plant Timber tree for test testImplementation libs.tests.timberJunitRule testImplementation libs.airbnb.mavericksTesting diff --git a/vector/src/test/java/im/vector/app/features/RoomMemberListControllerTest.kt b/vector/src/androidTest/java/im/vector/app/features/RoomMemberListControllerTest.kt similarity index 92% rename from vector/src/test/java/im/vector/app/features/RoomMemberListControllerTest.kt rename to vector/src/androidTest/java/im/vector/app/features/RoomMemberListControllerTest.kt index d32c3b5532..d282a8c223 100644 --- a/vector/src/test/java/im/vector/app/features/RoomMemberListControllerTest.kt +++ b/vector/src/androidTest/java/im/vector/app/features/RoomMemberListControllerTest.kt @@ -16,36 +16,26 @@ package im.vector.app.features -import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.airbnb.mvrx.Success -import com.airbnb.mvrx.test.MvRxTestRule import im.vector.app.core.epoxy.profiles.ProfileMatrixItemWithPowerLevelWithPresence +import im.vector.app.core.utils.waitUntil import im.vector.app.features.roomprofile.members.RoomMemberListCategories import im.vector.app.features.roomprofile.members.RoomMemberListController import im.vector.app.features.roomprofile.members.RoomMemberListViewState import io.mockk.every import io.mockk.mockk +import kotlinx.coroutines.test.runTest import org.amshove.kluent.shouldBeEqualTo -import org.junit.Rule import org.junit.Test -import org.junit.runner.RunWith import org.matrix.android.sdk.api.session.crypto.model.UserVerificationLevel import org.matrix.android.sdk.api.session.room.model.Membership import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary import org.matrix.android.sdk.api.session.room.model.RoomSummary -import org.robolectric.RobolectricTestRunner -@RunWith(RobolectricTestRunner::class) class RoomMemberListControllerTest { - @get:Rule - val mvrxTestRule = MvRxTestRule() - - @get:Rule - val instantExecutorRule = InstantTaskExecutorRule() - @Test - fun testControllerUserVerificationLevel() { + fun testControllerUserVerificationLevel() = runTest { val roomListController = RoomMemberListController( avatarRenderer = mockk { }, @@ -109,6 +99,8 @@ class RoomMemberListControllerTest { roomListController.setData(state) + waitUntil { !roomListController.hasPendingModelBuild() } + val models = roomListController.adapter.copyOfModels val profileItems = models.filterIsInstance()