I looked on the internet and found some examples of how to overcome this. I have used this library on a large project with many thousand of tests and as I updated the version of the library used different tests failed even before we started using the library.Initially this library depended on a specific version of Kotlin and Mockito, later versions have removed the dependency on Kotlin however I am guessing that testing every combination is not possible.There is no benefit here as we can overcome this issue with less than 10 lines of code. (Kotlin) Any workaround for annotation processing in Intellij IDEA Herrgott 13:28:43 581 2 intellij-idea/ kotlin/ annotations/ code-generation. I prefer not to take a dependency unless there is a significant benefit. One possible solution would be to use a library like mockito-kotlin. If the method being matched is written in Java then I think that it will work as all Java objects are implicitly nullable. In Kotlin the Any type represents the super type of all non-nullable types. This is because it can return void and this is not assignable to a non-nullable parameter. If you have a method written in kotlin that does not take a nullable parameter then we cannot match with it using Mockito.any(). Getting matchers to work with Kotlin can be a problem. Using kotlin and mockito together throws up some interesting problems, I have already looked at some of these. I have been using Mockito for a while and recently I have started a kotlin project.
0 Comments
Leave a Reply. |