Testing

Breaking static dependencies using Java 8 lambdas

Static dependencies are usually bad, because that dependencies are based on the class level and class objects can not be replaced at runtime in contrast to object instances.

That’s why static dependencies are usually a pain if it comes to tests. When you want to write a unit test you usually want to mock the […]

Enums as type discriminator anti-pattern

In Java 1.5 enums were introduced to ease handling of constant values. Enums can improve code quality, because they are types that the compiler can check. But they can also be misused and lower the code quality. In this blog I want to discuss the misuse of enums as type discriminators and show you why this […]

Bugs love logging to hide

A lot of projects run integration and unit tests, but often miss a little something – logging. When you use logging you often check if the log level is enabled or not before you log. But this means that you introduce a control flow statement that enables or disables some code. So if you […]