mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-29 16:40:32 +01:00
Add abstract viewmodel test for main thread execution
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
4687341755
commit
5f8e52b312
@ -0,0 +1,22 @@
|
|||||||
|
package com.nextcloud.talk.viewmodels
|
||||||
|
|
||||||
|
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
|
||||||
|
import io.reactivex.android.plugins.RxAndroidPlugins
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
import org.junit.BeforeClass
|
||||||
|
import org.junit.Rule
|
||||||
|
|
||||||
|
open class AbstractViewModelTest {
|
||||||
|
@get:Rule
|
||||||
|
val instantExecutorRule = InstantTaskExecutorRule()
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@BeforeClass
|
||||||
|
fun setUpClass() {
|
||||||
|
RxAndroidPlugins.setInitMainThreadSchedulerHandler {
|
||||||
|
Schedulers.trampoline()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,20 +1,12 @@
|
|||||||
package com.nextcloud.talk.viewmodels
|
package com.nextcloud.talk.viewmodels
|
||||||
|
|
||||||
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
|
|
||||||
import com.nextcloud.talk.test.fakes.FakeCallRecordingRepository
|
import com.nextcloud.talk.test.fakes.FakeCallRecordingRepository
|
||||||
import com.vividsolutions.jts.util.Assert
|
import com.vividsolutions.jts.util.Assert
|
||||||
import io.reactivex.android.plugins.RxAndroidPlugins
|
|
||||||
import io.reactivex.schedulers.Schedulers
|
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.BeforeClass
|
|
||||||
import org.junit.Rule
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.mockito.MockitoAnnotations
|
import org.mockito.MockitoAnnotations
|
||||||
|
|
||||||
class CallRecordingViewModelTest {
|
class CallRecordingViewModelTest : AbstractViewModelTest() {
|
||||||
|
|
||||||
@get:Rule
|
|
||||||
val instantExecutorRule = InstantTaskExecutorRule()
|
|
||||||
|
|
||||||
val repository = FakeCallRecordingRepository()
|
val repository = FakeCallRecordingRepository()
|
||||||
|
|
||||||
@ -35,14 +27,4 @@ class CallRecordingViewModelTest {
|
|||||||
|
|
||||||
Assert.equals(CallRecordingViewModel.RecordingStartLoadingState, viewModel.viewState.value)
|
Assert.equals(CallRecordingViewModel.RecordingStartLoadingState, viewModel.viewState.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
@JvmStatic
|
|
||||||
@BeforeClass
|
|
||||||
fun setUpClass() {
|
|
||||||
RxAndroidPlugins.setInitMainThreadSchedulerHandler {
|
|
||||||
Schedulers.trampoline()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user