


Mock relaxed for functions returning Unit.Spies, mockkStatic may not work on JDK 16+ InaccessibleObjectException/ IllegalAccessException: read more here.Inline functions cannot be mocked: see the discussion on this issue.(not sure after workaround if it is generally usable or not, please somebody report it) PowerMock needs a workaround to run together with MockK #79.Documentation can be found hereįrom version 1.13.0 MockK supports Kotlin 1.4 and higher Known issues quarkus-mockk adds support for mocking beans in Quarkus.springmockk introduced in official Spring Boot Kotlin tutorial.Expected behavior and behavior verification.Academy describing MockK from the very basics of mocking up to description of all advanced features. And obviously there is a function findLast () to return the last found element.įirst(), firstOrNull(), last(), lastOrNull() and component1–5() return exact elements from the collection.Check the series of articles “Mocking is not rocket science” at Kt. There is a really simple realization inside this function: public inline fun Iterable.forEachIndexed(action: (index: Int, T) -> Unit): Unit įind() returns you the first found element. The most common operation when you work with collections is iteration through collection items for (int i = 0 i friend.id = index Let’s check all important functions that we have in the llection framework and compare it to an implementation to Java. But if we compare it to Rx, there are no subscribers, observers, etc.

So the idea is that you have some stream of data, and using some functions you can receive some required state of the stream. This approach is very similar to Java 8 collections and Rx usage. Now I am going to show you the coolest thing in Kotlin collections – the functional approach Kotlin provides on top of collections. Software Engineer Android the two previous articles we talked about collections structure and all the possible ways to create them.
