Last active
April 23, 2019 21:20
-
-
Save jairovsky/795ea33598892f8d16b42f10c3bb5852 to your computer and use it in GitHub Desktop.
MockK: mockkStatic helper for top level functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun mockkStatic(fn: KFunction<Any>) { | |
fn.javaMethod | |
?.declaringClass | |
?.name | |
?.apply { mockkStatic(this) } | |
?: throw Exception("Couln't get declaringClass name from function ::${fn.name}") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment