The following syntax has worked to me.
mockkStatic(::sayHello.javaMethod!!.declaringClass.kotlin)
I’m surprised there is nothing on the jvm-stdlib
yet for this.
Edit:
This overload has now been introduced officially:
https://github.com/mockk/mockk/pull/518
mockkStatic(::sayHello)
Related Contents:
- How to write ternary conditional operator?
- Idiomatic way of logging in Kotlin
- Multiple variable let in Kotlin
- Difference between fold and reduce in Kotlin, When to use which?
- How to catch many exceptions at the same time in Kotlin?
- Best way to null check in Kotlin?
- How to add an item to an ArrayList in Kotlin?
- IntArray vs Array in Kotlin
- Kotlin’s Iterable and Sequence look exactly same. Why are two types required?
- How to clone object in Kotlin?
- Is Kotlin “pass-by-value” or “pass-by-reference”?
- Kotlin: Apply vs With
- Can “experimental” Kotlin coroutines be used in production?
- How to read a text file from resources in Kotlin?
- What is a “receiver” in Kotlin?
- Kotlin – Wait function
- What’s the difference between !! and ? in Kotlin?
- Swap Function in Kotlin
- What is the purpose of Unit-returning in functions
- How to obtain all subclasses of a given sealed class?
- How to extend a data class with toString
- How do I create an enum from an Int in Kotlin?
- Print 0001 to 1000 in Kotlin. How to add padding to numbers?
- Boolean – Int conversion in Kotlin
- Extending data class from a sealed class in Kotlin
- How to turn a Mutable Collection into an Immutable one
- Building a self-executable JAR with Gradle and Kotlin
- Static method imports in Kotlin
- does Any == Object
- How can I use stack in Kotlin?
- Using default function implementation of interface in Kotlin
- Return from lambdas or Kotlin: ‘return’ is not allowed here
- Mock static java methods using Mockk
- kotlin function default arguments from java
- Kotlin: Check if lazy val has been initialised
- Kotlin data class optional variable
- Creating exclusive ranges in Kotlin
- Force compilation error with sealed classes
- Utils class in Kotlin
- Dagger and Kotlin. Dagger doesn’t generate component classes
- Correctly implementing wait and notify in Kotlin
- How can I suppress unchecked cast warnings?
- Identity equality for arguments of types Int and Int is deprecated
- Write a large Inputstream to File in Kotlin
- Kotlin outer scope
- Convert Array to List in Kotlin
- Why Kotlin needs to bundle its runtime after compiled?
- MutableStateFlow is not emitting values after 1st emit kotlin coroutine
- Divide list into parts
- Function definition: fun vs val