Category Archives: Uncategorized

Unit testing default methods in interfaces

Java 8 has introduced a nice feature, default (so-called “defender”) methods in interfaces. These methodsĀ are implemented in the interface, but can be overridden. Now how can we unit-test these default methods? A naive approach would be: in your unit test … Continue reading

Posted in Uncategorized | Leave a comment

How to compare types in Java

Here’s an overview of the different methods to identify a type or Object in Java. There are three basic cases I want to detect if two variables point to Objects of the same type I want to detect if two … Continue reading

Posted in Uncategorized | Tagged , , | 2 Comments