https://kotlinlang.org logo
#mockk
Title
# mockk
a

Anthony f

08/23/2019, 2:20 PM
@oleksiyp hello, could we specify the target of the @Mockk annotation, like @field:Mockk ? Will Mockk work correctly ?
We use to Toothpick as DI framework
And TP use reflexion to find which dependencies has to be mocked (with getDeclaredField in Java)
in standard, Mockk use the property target, so TP do not get the field.
@oleksiyp had you any chance to see my question ?
o

oleksiyp

09/06/2019, 7:24 AM
Hi, Ive seen, but not very experienced with this annotations and dont have an answer
a

Anthony f

09/06/2019, 9:16 AM
I’m not too...,however it does mean that mockk works differently that mockito and others which create mocks that are accessible by fields
so to make it running, we have to both annotante @Mockk and @field:Mockk (for toothpick)
@oleksiyp I’m still on that issue, I create a issue about TP, with an example to helping us in finding a solution
@oleksiyp did you had a chance to review the issue in order to give your opinion, that would help taking the best decision.
o

oleksiyp

09/25/2019, 5:59 AM
Probably it is easy to fix. Although you should count I am maintaining mostly urgent cases now. https://github.com/mockk/mockk/issues/356
a

Anthony f

09/25/2019, 6:14 PM
Ok @oleksiyp , I didn't know. That why you are not responding as fast as usually ;). Please go to the issue and just give your input, I think both fixes would work, we just need to figure out what is the good solution. As you diverged from mockito and other, we need to know if this is for a good reason, or just for no reason.
From the fix, it should be almost no effort if this is just targeting the field, but I have no clue the derived impact for mockk, and even if it exists !
2 Views