The old is deprecated in favour of the new (notice the changed package name).The text inside should be exactly mock-maker-inline The name of Mockito’s configuration file you need to add (as described in the linked blog post above) should be exactly test/resources/mockito-extensions/.That’s the easy case – the update will be smooth, just a few things to note: There were a few pain-points while updating to the latest one, so hopefully this post will save you some time when going through the same process.Ĭase 1 – Mockito is the only mocking library in your project Since mocking is something used only in tests … and usually it just works, we’ve neglected Mockito and were still using a very outdated version (1.10.19) in our project. Hadi Hariri highlighted in his excellent blog post that Mockito version 2.1.0 and above can perform the magic of mocking final classes. Since we don’t want to open up everything just for testing purposes, we need another solution. Unfortunately Mockito, one of the most popular mocking libraries for Java projects, can’t easily mock final classes. As we know all classes and methods are final be default in Kotlin, unless specifically open-ed. With the exponentially increasing usage of Kotlin these days, many developers face the issue of how to test the newly created Kotlin classes.
0 Comments
Leave a Reply. |