Stubbing with doAnswer vs doReturn – what’s the difference?
Most of the times while stubbing with Mockito or MockK you will use doReturn construction. But do you know, that you can stub your test double method in other way – with doAnswer. Let’s take a look a both stubbing types.
How to mock final classes in Kotlin with Mockito?
Mockito cannot mock/spy because your class is final class? We can fix that.
How to use jUnit4 & jUnit5 in one project?
When you have existing test suite containing jUni4 tests and you want to migrate slowly to jUnit5 to make use of new APIs and modern test engine, you may encounter some issues – not all tests will be visible in reports.
Libraries for Kotlin & JVM Testing
JVM and Kotlin testing libraries – Gradle dependencies and latest versions.
Don’t mock static: test Timber Logger with trees
Learn how to create custom Timber Tree to test log outputs in unit tests. Mocking Timber, unit testing logs.
Don’t mock static: test SLF4J Logger with appenders
Do you want to assert that SLF4J actually logged warn with proper message? Check this guide on how to mock logger in tests, in Kotlin and Java.
Building assertions with Strikt
Strikt is assertion library built for Kotlin with API which allows building multi assertions and gives us readable assertion errors.
Fighting Testing Boilerplate with IntelliJ IDEA Live Templates
Writing tests involves repeating some patterns over and over again. IntelliJ IDEA can shorten the process of test creation with the help of live templates.
How to test a time-dependent coroutine
The issue Unit testing is the fastest way to check if some piece of our application works as we expect. But what if we have to test some features that strongly depend on time? Should we allow our tests execute for instance for few minutes? Of course we shouldn’t! In this blog post I will […]
IntelliJ Live Template that makes my life little easier
IntelliJ is great tool for developer productivity. Check how can we adjust IDE to our preferences. Tutorial: how to create custom live template?