Merge pull request #7286 from vector-im/tech/remove-robolectric-dependency

Remove Robolectric, make previous Robolectric test an instrumentation test
This commit is contained in:
Benoit Marty 2022-10-04 15:52:49 +02:00 committed by GitHub
commit caffdbd8a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 16 deletions

View file

@ -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",
]
]

View file

@ -210,7 +210,6 @@ ext.groups = [
'org.ow2.asm',
'org.ow2.asm',
'org.reactivestreams',
'org.robolectric',
'org.slf4j',
'org.sonatype.oss',
'org.testng',

View file

@ -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

View file

@ -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<ProfileMatrixItemWithPowerLevelWithPresence>()