Supersonic Subatomic Mocking: How to test your Quarkus app with Kotlin, JUnit and MockK
The relatively young Quarkus framework is an increasingly serious competitor to established microservice frameworks such as Spring Boot. This is largely due to the fact that the powerful yet lightweight application framework offers small memory footprint and reduced boot time. Hence, it's not only interesting for developing microservices in containerized cloud platforms such as Kubernetes, but also for serverless computing.
And it supports – like almost all relevant JVM frameworks – my favorite programming language: Kotlin!
When developing an application with Quarkus and Kotlin you will sooner or later (hopefully sooner 😉) write isolated tests to determine whether your code behaves as expected. And as a Kotlin developer you probably want to use the technologies you are already familiar with, e.g. JUnit and MockK. But there are certain aspects you should be aware of when testing and mocking CDI beans in Quarkus.
Interested? Then let me share our experiences how to test a Quarkus app with Kotlin, JUnit and MockK. Practical insights guaranteed!