Uncategorized

Article cover for Mockito Final Kotlin

How to mock final classes in Kotlin with Mockito?

Let’s consider the following system under test: And following test method: if you are unsure how to use Mockito with Kotlin, check https://kotlintesting.com/using-mockito-in-kotlin-projects/ After running this test it is likely that you will encounter the following error: Classes marked as „final” should not be extended Kotlin default modifier translates to „final” in Java Classes in …

How to mock final classes in Kotlin with Mockito? Read More »

JVM Testing Newsletter | October 2021

Articles & blogposts Mocking Matchers API Story about the interesting behavior of mocking library and the difficulties of defining API surface for a library. Mocking Matchers API Diving into Matchers API of various mocking libraries such as Mockito, mockito-kotlin, mockk Krossovochkin Testing Hybrid Jetpack Compose Apps Guide to testing Jetpack Compose on Android using androidx …

JVM Testing Newsletter | October 2021 Read More »

JVM Testing Newsletter | September 2021

Articles & blogposts Let’s code: graphs in java Step-by-step TDD implementation of graphs in plain Java. Let’s code: graphs in java I have been obsessed with graphs for a few years now. This obsession has resulted in three projects:… DEV CommunityJohn Mercier 5 Reasons Why You Should Never, Ever Write Tests Clickbait? Maybe a little. …

JVM Testing Newsletter | September 2021 Read More »

JVM Testing Newsletter | July 2021

Articles & blogposts Hidden Perks of Unit Tests Hidden Perks of Unit Tests Unit testing is one of my favorite software engineering techniques. In our industry, the word “testing” is strongly associated with the word “bug”, so the common belief is that unit tests help find/eradicate/prevent bugs. And while this is not untrue, there’s much …

JVM Testing Newsletter | July 2021 Read More »

Don’t mock static: test SLF4J Logger with appenders

Most of the time you would like to inject dependencies to your class directly – through the class constructor or by setting required properties via setters. No matter what programming style you prefer you may encounter situation when some dependency cannot or shouldn’t be passed directly to your system under test. Good example of that …

Don’t mock static: test SLF4J Logger with appenders Read More »