File tree Expand file tree Collapse file tree 5 files changed +14
-19
lines changed
src/main/kotlin/org/mockito/kotlin Expand file tree Collapse file tree 5 files changed +14
-19
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ dependencies {
2525 compileOnly " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
2626 compileOnly ' org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0'
2727
28- compile " org.mockito:mockito-core:3.12.4 "
28+ compile " org.mockito:mockito-core:4.0.0 "
2929
3030 testCompile ' junit:junit:4.12'
3131 testCompile ' com.nhaarman:expect.kt:1.0.0'
Original file line number Diff line number Diff line change @@ -90,19 +90,6 @@ fun verifyNoInteractions(vararg mocks: Any) {
9090 Mockito .verifyNoInteractions(* mocks)
9191}
9292
93- /* *
94- * @deprecated
95- *
96- * Please migrate your code to [verifyNoInteractions].
97- */
98- @Deprecated(
99- " Use verifyNoInteractions() instead." ,
100- ReplaceWith (" verifyNoInteractions(vararg mocks: Any)" )
101- )
102- fun verifyZeroInteractions (vararg mocks : Any ) {
103- Mockito .verifyZeroInteractions(* mocks)
104- }
105-
10693/* *
10794 * Allows verifying exact number of invocations.
10895 *
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ dependencies {
2222 compile files(" ${ rootProject.projectDir} /mockito-kotlin/build/libs/mockito-kotlin-${ version} .jar" )
2323
2424 compile " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
25- compile " org.mockito:mockito-core:2.23 .0"
25+ compile " org.mockito:mockito-core:4.0 .0"
2626
2727 testCompile " junit:junit:4.12"
2828 testCompile " com.nhaarman:expect.kt:1.0.0"
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ import org.mockito.kotlin.whenever
1212import org.junit.Test
1313import org.mockito.Mockito
1414import org.mockito.exceptions.verification.WantedButNotInvoked
15+ import org.mockito.invocation.DescribedInvocation
16+ import org.mockito.kotlin.argumentCaptor
1517import org.mockito.listeners.InvocationListener
1618import org.mockito.mock.SerializableMode.BASIC
1719import java.io.PrintStream
@@ -182,7 +184,10 @@ class MockingTest : TestBase() {
182184 fail(" Expected an exception" )
183185 } catch (e: WantedButNotInvoked ) {
184186 /* Then */
185- verify(out ).println (" methods.stringResult();" )
187+ argumentCaptor<DescribedInvocation >().apply {
188+ verify(out ).println (capture())
189+ expect(lastValue.toString()).toBe(" methods.stringResult();" )
190+ }
186191 }
187192 }
188193
@@ -314,7 +319,10 @@ class MockingTest : TestBase() {
314319 fail(" Expected an exception" )
315320 } catch (e: WantedButNotInvoked ) {
316321 /* Then */
317- verify(out ).println (" methods.stringResult();" )
322+ argumentCaptor<DescribedInvocation >().apply {
323+ verify(out ).println (capture())
324+ expect(lastValue.toString()).toBe(" methods.stringResult();" )
325+ }
318326 }
319327 }
320328
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import org.mockito.kotlin.any
44import org.mockito.kotlin.mock
55import org.mockito.kotlin.verify
66import org.junit.Test
7- import org.mockito.exceptions.verification.TooLittleActualInvocations
7+ import org.mockito.exceptions.verification.TooFewActualInvocations
88import org.mockito.exceptions.verification.junit.ArgumentsAreDifferent
99
1010class VerifyTest : TestBase () {
@@ -30,7 +30,7 @@ class VerifyTest : TestBase() {
3030 }
3131 }
3232
33- @Test(expected = TooLittleActualInvocations ::class )
33+ @Test(expected = TooFewActualInvocations ::class )
3434 fun verifyFailsWithWrongCount () {
3535 val iface = mock<TestInterface >()
3636
You can’t perform that action at this time.
0 commit comments