feat: add in dexmaker inline to mock final classes with android tests (experiment)
This commit is contained in:
parent
e419024f6b
commit
81111ea54a
|
@ -301,7 +301,7 @@ dependencies {
|
|||
testImplementation 'org.assertj:assertj-core:3.11.1'
|
||||
testImplementation "org.mockito:mockito-inline:4.10.0"
|
||||
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
||||
androidTestImplementation "org.mockito:mockito-android:4.10.0"
|
||||
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito-inline:2.28.3'
|
||||
androidTestImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
||||
testImplementation "androidx.test:core:$testCoreVersion"
|
||||
testImplementation "androidx.arch.core:core-testing:2.2.0"
|
||||
|
@ -313,7 +313,6 @@ dependencies {
|
|||
androidTestImplementation('com.adevinta.android:barista:4.2.0') {
|
||||
exclude group: 'org.jetbrains.kotlin'
|
||||
}
|
||||
|
||||
// AndroidJUnitRunner and JUnit Rules
|
||||
androidTestImplementation 'androidx.test:runner:1.5.2'
|
||||
androidTestImplementation 'androidx.test:rules:1.5.0'
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package org.thoughtcrime.securesms.groups
|
||||
package network.loki.messenger.groups
|
||||
|
||||
import android.content.Context
|
||||
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
|
||||
import junit.framework.TestCase.assertNotNull
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import network.loki.messenger.libsession_util.util.Sodium
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
|
@ -19,12 +16,12 @@ import org.session.libsession.utilities.TextSecurePreferences
|
|||
import org.session.libsignal.utilities.Hex
|
||||
import org.session.libsignal.utilities.IdPrefix
|
||||
import org.session.libsignal.utilities.SessionId
|
||||
import org.thoughtcrime.securesms.MainCoroutineRule
|
||||
import org.thoughtcrime.securesms.database.ConfigDatabase
|
||||
import org.thoughtcrime.securesms.database.Storage
|
||||
import org.thoughtcrime.securesms.dependencies.ConfigFactory
|
||||
import org.thoughtcrime.securesms.groups.CreateGroupState
|
||||
import org.thoughtcrime.securesms.groups.CreateGroupViewModel
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@RunWith(MockitoJUnitRunner::class)
|
||||
class ClosedGroupViewTests {
|
||||
|
||||
|
@ -37,13 +34,6 @@ class ClosedGroupViewTests {
|
|||
private val keyPair = Sodium.ed25519KeyPair(seed)
|
||||
private val userSessionId = SessionId(IdPrefix.STANDARD, Sodium.ed25519PkToCurve25519(keyPair.pubKey))
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@get:Rule
|
||||
var mainCoroutineRule = MainCoroutineRule()
|
||||
|
||||
@get:Rule
|
||||
var taskRule = InstantTaskExecutorRule()
|
||||
|
||||
@Mock lateinit var textSecurePreferences: TextSecurePreferences
|
||||
lateinit var storage: Storage
|
||||
|
||||
|
@ -63,7 +53,7 @@ class ClosedGroupViewTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `Should error on empty name`() {
|
||||
fun tryCreateGroup_shouldErrorOnEmptyName() {
|
||||
val viewModel = createViewModel()
|
||||
val state = CreateGroupState(
|
||||
groupName = "",
|
||||
|
@ -75,7 +65,7 @@ class ClosedGroupViewTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `Should error on empty members`() {
|
||||
fun tryCreateGroup_shouldErrorOnEmptyMembers() {
|
||||
val viewModel = createViewModel()
|
||||
val state = CreateGroupState(
|
||||
groupName = "group",
|
||||
|
@ -87,7 +77,7 @@ class ClosedGroupViewTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `Should work with valid name and members`() {
|
||||
fun tryCreateGroup_shouldSucceedWithCorrectParameters() {
|
||||
val viewModel = createViewModel()
|
||||
val state = CreateGroupState(
|
||||
groupName = "group",
|
Loading…
Reference in New Issue