Kotlin

Mocking without reflection for Kotlin/Multiplatform

D.kotlin
Salomon BRYS
<p>Mocking typically involves reflection: an efficient mocker can create implementations of interfaces or even concrete classes on the go by reflecting on their methods and properties. These required capabilities do not exist in Kotlin/Multiplatform, so we will explore an alternative method to runtime reflection: a compile-time symbol processor.</p>
Using Mocking as an excuse, we will explore how we can use KSP (Kotlin Symbol Processor) to circumvent the absence of reflection and generate efficient mocks at compile time. We will also see the limitations that multiplatform brings to both the KSP Mocker generator and its associated runtime. We will explain the choices that we made when developing the MocKMP multiplatform mocking library, and why they were needed. We will then demonstrate the clean DSL API we offer to describe and verify your mocks. Finally, we will demonstrate how to architecture all these moving parts (KSP plugin, mocker generator, mocker runtime) using a custom Gradle Plugin to make using MocKMP as easy as it gets.

Additional information

Type devroom

More sessions

2/6/22
Kotlin
D.kotlin
<p>Welcoming participants to the virtual edition of the Kotlin DevRoom @ FOSDEM</p>
2/6/22
Kotlin
Anton Arhipov
D.kotlin
<p>In 2021 Kotlin turned 10 and the team delivered 2 major releases (1.5.0 and 1.6.0) and a few minors. The main themes of those releases were Java interoperability and consistency of the language features. Meanwhile, Kotlin/JS has been promoted to Beta and KMM is on its path to reaching Beta status as well. However, one long-running project in Kotlin is the development of the new compiler, K2, which should set a solid foundation for the language and the ecosystem for the years ahead.</p> ...
2/6/22
Kotlin
Romain Boisselle
D.kotlin
<p>Dependency Injection is a complicated topic, and when used in a project that compiles to multiple targets through different compilers &amp; runtimes, it can lead to serious headaches. However, the Inversion of Control pattern brings a lot of architecture features and safety.</p>
2/6/22
Kotlin
Marcin Moskala
D.kotlin
<p>The Kotlin typing system is amazingly designed. It was designed and constantly improved for years, and it was built based on experiences from other typing systems. As a result it gives us very comfortable nullability support, type inference, universal guards, and much more. In this presentation, we’ll dive deep into Kotlin typing systems and how small design choices lead to a better programming experience.</p>
2/6/22
Kotlin
Holger Brandl
D.kotlin
<p>kalasim is a discrete event simulator written in pure Kotlin that enables complex, performant, dynamic process models. It provides a statically typed API, dependency injection, modern persistence, structured logging and automation capabilities.</p> <p>kalasim is designed for simulation practitioners, process analysts and industrial engineers, who need to go beyond the limitations of existing simulation tools to model and optimize their business-critical use-cases. In contrast to many other ...
2/6/22
Kotlin
Dinorah Tovar
D.kotlin
<p>Grab your notebook cause in this talk, we are gonna talk about Math and Kotlin! Especially in the power that Kotlin has to run long operations and the power to perform some calculations like computing min, max, an average of numbers stored in a list! - from sumOf {} to multi-dimensional arrays to charts!</p>
2/6/22
Kotlin
Julien Lengrand-Lambert
D.kotlin
<p>picoCLI is a small library that can be used to create JVM based command line interface applications. Within 30 minutes, we'll look at how to setup a project, create a small application and package it for others to use.</p>