Skip to content

Commit

Permalink
mockito#478 Upgrade Mockito
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-krecan committed May 19, 2023
1 parent 1ab7540 commit 093ceca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mockito-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies {
compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0'

compile "org.mockito:mockito-core:4.5.1"
compile "org.mockito:mockito-core:5.3.1"

testCompile 'junit:junit:4.13.2'
testCompile 'com.nhaarman:expect.kt:1.0.1'
Expand Down
4 changes: 2 additions & 2 deletions tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ dependencies {
compile files("${rootProject.projectDir}/mockito-kotlin/build/libs/mockito-kotlin-${version}.jar")

compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.mockito:mockito-core:4.5.1"
compile "org.mockito:mockito-core:5.3.1"

testCompile 'junit:junit:4.13.2'
testCompile "com.nhaarman:expect.kt:1.0.1"
}
}
11 changes: 6 additions & 5 deletions tests/src/test/kotlin/test/MatchersTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import com.nhaarman.expect.expect
import com.nhaarman.expect.expectErrorWithMessage
import org.junit.Test
import org.mockito.ArgumentMatcher
import org.mockito.internal.matchers.VarargMatcher
import org.mockito.invocation.InvocationOnMock
import org.mockito.kotlin.*
import org.mockito.stubbing.Answer
import java.io.IOException
import kotlin.check

class MatchersTest : TestBase() {

Expand Down Expand Up @@ -321,14 +319,17 @@ class MatchersTest : TestBase() {
private val match: ((T) -> Boolean),
private val success: R,
private val failure: R
) : ArgumentMatcher<T>, VarargMatcher, Answer<R> {
) : ArgumentMatcher<T>, Answer<R> {
private var anyMatched = false

override fun matches(t: T): Boolean {
anyMatched = anyMatched or match(t)
return true
}

override fun answer(i: InvocationOnMock) = if (anyMatched) success else failure
override fun answer(i: InvocationOnMock) = if (anyMatched)
success
else
failure
}
}
}

0 comments on commit 093ceca

Please sign in to comment.