Created
July 23, 2021 06:39
-
-
Save serinth/727f7d52d066dc41a84905c762d1c721 to your computer and use it in GitHub Desktop.
Kotlin Test Private method
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
// buildVerifyEmailHTMLBody is the private method name. Takes on argument of String | |
val instance = SendGridEmailer(mock {}) | |
val privateMethod = instance.javaClass.getDeclaredMethod("buildVerifyEmailHTMLBody", String::class.java) | |
privateMethod.isAccessible = true | |
val params = arrayOfNulls<Any>(1) | |
params[0] = "https://url/verify/token" | |
assertEquals(expected, privateMethod.invoke(instance, *params)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment