just to understand it clear, when it says "static ...
# mockk
g
just to understand it clear, when it says "static mocks in mockk" it actually refers to extension functions? Or, is it also possible to mock something like
Html.fromHtml()
?
o
So basically static mockk just allow to mock java static methods. Top level extension functions are implemented as static methods in Java byte code, so that's why it's needed. Other types of extension functions require different mocking approach. Making automagical detection what type of extension function you have I doubt is possible, so you need to understand this pieces of implementation details
g
mockk just allow to mock java static methods
android.text.Html.fromHtml()
is a java class in android SDK. To be able to mock it, I wrapped it into a kotlin extension function and mocked that function with mockkStatic. Works perfectly, thanks for that! Just to clarify, the question remains, is it possible to mock the
#fromHtml()
directly, assuming it's not an extension and comes from java?
o
Just try, depends many things