Skip to content

Commit

Permalink
mockk#510 | Rename variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulam committed Oct 15, 2020
1 parent d4f75a7 commit 63a2ce7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Expand Up @@ -19,7 +19,7 @@ class ChainedCallDetector(safeToString: SafeToString) {
fun detect(
callRounds: List<CallRound>,
callN: Int,
matcherList: SignatureMatchersList
matchersList: SignatureMatchersList
) {
val callInAllRounds = callRounds.map { it.calls[callN] }
val zeroCall = callInAllRounds[0]
Expand Down Expand Up @@ -51,7 +51,7 @@ class ChainedCallDetector(safeToString: SafeToString) {

log.trace { "Signature for $nArgument argument of ${zeroCall.method.toStr()}: $signature" }

val matcherBySignature = matcherList.remove(signature)
val matcherBySignature = matchersList.remove(signature)

return buildMatcher(
nArgument == 0,
Expand Down Expand Up @@ -84,7 +84,7 @@ class ChainedCallDetector(safeToString: SafeToString) {

log.trace { "Signature for $nArgument/$nVarArg argument of ${zeroCall.method.toStr()}: $signature" }

val matcherBySignature = matcherList.remove(signature)
val matcherBySignature = matchersList.remove(signature)
varArgMatchers.add(
buildMatcher(
nArgument == 0 && nVarArg == 0,
Expand Down
Expand Up @@ -45,7 +45,7 @@ class SignatureMatcherDetector(
}
}

val matcherList = SignatureMatchersList()
val matchersList = SignatureMatchersList()
val allCompositeMatchers = mutableListOf<List<CompositeMatcher<*>>>()

fun gatherMatchers() {
Expand All @@ -59,10 +59,10 @@ class SignatureMatcherDetector(
})
}

matcherList.add(signature, matcher)
matchersList.add(signature, matcher)
}

log.trace { "Matcher list: $matcherList" }
log.trace { "Matcher list: $matchersList" }
}

@Suppress("UNCHECKED_CAST")
Expand All @@ -77,7 +77,7 @@ class SignatureMatcherDetector(

log.trace { "Signature for $nOp operand of $matcher composite matcher: $signature" }

matcherList.remove(signature)
matchersList.remove(signature)
?: ChainedCallDetector.eqOrNullMatcher(matcher.operandValues[nOp])
} as List<Matcher<Any?>>?
}
Expand All @@ -90,13 +90,13 @@ class SignatureMatcherDetector(

repeat(nCalls) { callN ->
val detector = chainedCallDetectorFactory()
detector.detect(callRounds, callN, matcherList)
detector.detect(callRounds, callN, matchersList)
calls.add(detector.call)
}

processCompositeMatchers()
if (matcherList.isNotEmpty()) {
throw MockKException("Failed matching mocking signature for\n${callRounds[0].calls.joinToString("\n")}\nleft matchers: $matcherList")
if (matchersList.isNotEmpty()) {
throw MockKException("Failed matching mocking signature for\n${callRounds[0].calls.joinToString("\n")}\nleft matchers: $matchersList")
}
}
}
Expand Down
Expand Up @@ -37,9 +37,9 @@ class ChainedCallDetectorTest {

@Test
fun givenTwoCallsRoundsWithOneCallOneArgWhenDetectCallsHappenThenOneCallWithArgIsReturned() {
val matcherMap = SignatureMatchersList()
val matchersList = SignatureMatchersList()

matcherMap.add(listOf(signedMatcher1.signature, signedMatcher2.signature), signedMatcher1.matcher)
matchersList.add(listOf(signedMatcher1.signature, signedMatcher2.signature), signedMatcher1.matcher)

every { callRound1.calls } returns listOf(call1)
every { callRound2.calls } returns listOf(call2)
Expand All @@ -56,7 +56,7 @@ class ChainedCallDetectorTest {
every { call1.method.varArgsArg } returns -1
every { call2.method.varArgsArg } returns -1

detector.detect(listOf(callRound1, callRound2), 0, matcherMap)
detector.detect(listOf(callRound1, callRound2), 0, matchersList)

assertEquals("abc", detector.call.matcher.method.name)
assertEquals(listOf<Matcher<*>>(EqMatcher(5)), detector.call.matcher.args)
Expand Down

0 comments on commit 63a2ce7

Please sign in to comment.