Skip to content

Commit

Permalink
#29 fixing java Class matching
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksiyp committed Feb 19, 2018
1 parent da73c3a commit c4a7aab
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Expand Up @@ -15,7 +15,7 @@ class JvmAnyValueGenerator : AnyValueGenerator() {
java.lang.Long::class -> 0L
java.lang.Float::class -> 0.0F
java.lang.Double::class -> 0.0

java.lang.Class::class -> Object::class.java

else -> super.anyValue(cls) {
if (cls.java.isArray) {
Expand Down
23 changes: 23 additions & 0 deletions mockk/src/test/kotlin/io/mockk/gh/Issue29Test.kt
@@ -0,0 +1,23 @@
package io.mockk.gh

import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import org.junit.Test
import kotlin.test.assertFalse


class Issue29Test {
class MockCls {
fun op(klass: Class<*>): Boolean = true
}

@Test
fun matchingAnyClass() {
val mock = mockk<MockCls>()
every { mock.op(any()) } returns false
assertFalse(mock.op(Long::class.java))
verify { mock.op(any()) }
}
}

0 comments on commit c4a7aab

Please sign in to comment.