Kotlin with its default and named arguments makes the call site code of a function elegant and readable.

In this article, I’ll be sharing my technique of using these language constructs to create helper functions for better mocking.

Scenario

Imagine a complex type like Company as shown below. Company composes many nested types like Employee , CompanyEvent , Product which themselves are complex types. (You don’t have to fully understand these types but just that such composition can get huge even for a moderate sized application).