File tree Expand file tree Collapse file tree 3 files changed +10
-12
lines changed
src/test/kotlin/org/wordpress/aztec Expand file tree Collapse file tree 3 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -67,8 +67,7 @@ dependencies {
6767 androidTestImplementation ' androidx.test.espresso:espresso-core:3.2.0' , {
6868 exclude group : ' com.android.support' , module : ' support-annotations'
6969 }
70- testImplementation " org.mockito:mockito-inline:$mockitoVersion "
71- testImplementation " org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion "
70+ testImplementation " io.mockk:mockk:${ mockkVersion} "
7271
7372 implementation " org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion "
7473 implementation " org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutinesVersion "
Original file line number Diff line number Diff line change 11package org.wordpress.aztec
22
3+ import io.mockk.every
4+ import io.mockk.mockk
35import org.junit.Assert
46import org.junit.Test
57import org.junit.runner.RunWith
6- import org.mockito.Mock
7- import org.mockito.Mockito
88import org.robolectric.RobolectricTestRunner
99import org.wordpress.aztec.spans.MarkSpan
1010
1111@RunWith(RobolectricTestRunner ::class )
1212class MarkSpanTest {
13- @Mock
14- val markSpan = Mockito .mock(MarkSpan ::class .java)
1513 /* *
1614 * Test used to confirm two crashes related are fixed.
1715 *
@@ -22,8 +20,9 @@ class MarkSpanTest {
2220 var error = false
2321 var result: Int? = null
2422 try {
25- Mockito .`when `(markSpan.safelyParseColor(" " )).thenCallRealMethod()
26- result = markSpan.safelyParseColor(" " )
23+ val span = mockk<MarkSpan >()
24+ every { span.safelyParseColor(" " ) } coAnswers { callOriginal() }
25+ result = span.safelyParseColor(" " )
2726 } catch (e: Exception ) {
2827 error = true
2928 }
@@ -41,8 +40,9 @@ class MarkSpanTest {
4140 var error = false
4241 var result: Int? = null
4342 try {
44- Mockito .`when `(markSpan.safelyParseColor(null )).thenCallRealMethod()
45- result = markSpan.safelyParseColor(null )
43+ val span = mockk<MarkSpan >()
44+ every { span.safelyParseColor(null ) } coAnswers { callOriginal() }
45+ result = span.safelyParseColor(null )
4646 } catch (e: Exception ) {
4747 error = true
4848 }
Original file line number Diff line number Diff line change 8080 jSoupVersion = ' 1.11.3'
8181 wordpressUtilsVersion = ' 3.5.0'
8282 espressoVersion = ' 3.0.1'
83- mockitoVersion = ' 4.5.1'
84- mockitoKotlinVersion = ' 4.1.0'
83+ mockkVersion = ' 1.12.8'
8584
8685 // other
8786 wordpressLintVersion = ' 2.0.0'
You can’t perform that action at this time.
0 commit comments