Refactoring from Java to Kotlin

Step one

Open Java file in IntelliJ, hit double shift and type "java to kotlin"

Step two

Clean up after converter. You can remove unnecessary access modifiers, modify or delete some annotations.

Step three

Introduce Kotlin-idiomatic APIs. Use Kotlin-Mockito or MockK instead of regular Mockito, add data classes for type safety, change test suite definition from annotated Junit classes to DSL-style specs.  

// Kotest - test suitę definition, assertions
testImplementation "io.kotest:kotest-runner-junit5:$version"

// Strikt - assertions for Kotlin
testImplementation "io.strikt:strikt-core:0.31.0"

// Mockito Kotlin - Kotlin idiomatic mocking with Mockito
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"

//MockK – mocking library for Kotlin
testImplementation "io.mockk:mockk:{version}"

Further reading

Want to work with me on cool projects?

Check openings at Tango Agency:

Tango - Job offers in IT at No Fluff Jobs
Transparent Employer with salary brackets in every job offer!

Or drop me an email to