Convert a batch of tests from mockito -> mockk.

Resolves #13832
This commit is contained in:
Jameson Williams
2024-12-10 01:15:01 -06:00
committed by Greyson Parrelli
parent 8ddbc57c7c
commit 57eeed33f0
8 changed files with 137 additions and 199 deletions

View File

@@ -1,14 +1,12 @@
package org.thoughtcrime.securesms.sms
import android.app.Application
import io.mockk.every
import io.mockk.mockk
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
import org.thoughtcrime.securesms.attachments.Attachment
@@ -36,18 +34,15 @@ import java.util.concurrent.atomic.AtomicLong
@RunWith(RobolectricTestRunner::class)
@Config(application = Application::class)
class UploadDependencyGraphTest {
private val jobManager: JobManager = mock()
private var uniqueLong = AtomicLong(0)
@Before
fun setUp() {
whenever(jobManager.startChain(any<Job>())).then {
JobManager.Chain(jobManager, listOf(it.getArgument(0)))
private val jobManager = mockk<JobManager> {
every { startChain(any<Job>()) } answers {
val job = args.first() as Job
JobManager.Chain(this@mockk, listOf(job))
}
}
private var uniqueLong = AtomicLong(0)
@Test
fun `Given a list of Uri attachments and a list of Messages, when I get the dependencyMap, then I expect a times m results`() {
// GIVEN