Consumer Contract Testing

Anyone who has ever worked with Web APIs, and who hasn’t, will be aware of the difficulties of testing in an API environment. When testing an API, there are two sides to consider, that of the producer and that of the consumer. If both do not work hand in hand, then problems are inevitable. Consumer contract tests are designed to avoid some of the difficulties in API testing.

Mutation Testing

Java Bibliotheken

When I first heard about mutation testing, I was – to put it kindly – very confused. The idea that we change our code to see which tests fail doesn’t look particularly promising at first glance. But if you take a closer look at the approach, you realize the potential it holds.

Records on the rise – Goodbye Lombok

Since the introduction of Java Records in Java 14 (JEP 359), their support in many frameworks has continued to grow. Support is now so great that we should consider banning Lombok from all our projects.

Bitemporal Data Storage

When storing data, their temporal changes are often not sufficiently taken into account. The following example of a club member database shows the problems of simplified temporal data storage and the advantages of bitemporal data storage.

Presentations with AsciiDoctor

Sometimes even developers want to present something. It’s nice when there’s a tool that picks up the developers in their comfort zone. Software developers are a special clientele and have very specific requirements for a software solution for creating and giving presentations.

Better names for JUnit 5 Test

Java Bibliotheken

The JUnit 5 test library offers a wide range of options for extending the framework and thus simplifying the work of software developers. One of these options is the DisplayNameGenerator, which can be used to modify the generation of test names in the console output. When creating exercises for a course, I was surprised to find that there is a DisplayNameGenerator that replaces underscores with spaces, but none that handles the camel case form. Fortunately, this can be changed.

Error Details in Spring Boot with RFC 7807

Java Bibliotheken

Spring Boot has an excellent error mechanism for REST endpoints. A @RestontrollerAdvice provides handling methods for various types of exception that can occur when processing REST requests. If you are not careful here, you can end up with an unsightly spread of different error message formats.

Eigene DSL mit CongoCC erstellen (2)

Java Bibliotheken

Im ersten Beitrag zum Thema wurde eine einfache DSL zur Verarbeitung von CSV Dateien vorgestellt. In diesem Beitrag soll die DSL um einige weitere Feature ergänzt werden.

Java Expressions durch MapStruct Qualifier ersetzen

MapStruct ist eine beliebte Bibliothek um Daten zwischen unterschiedlichen Datentypen zu konvertieren. Für POJO Konvertierungen wird im einfachsten Fall jedes Attribut auf ein gleichnamiges Attribut in der Ziel-Instanz gemapped. In Sonderfällen muss auf die Annotation @Mapping zurückgegriffen werden um eine spezielle Konvertierung zu erzwingen. Häufig werden die nachteiligen Java Expressions genutzt. Die bessere Alternative ist der Einsatz von Qualifiern.

Sneaky Throws – Exceptions aus dem Hinterhalt

Die Einführung der Generics in Java 8 hat zur einigen eigentümlichen Konsequenzen geführt. Die meisten dieser Konsequenzen fußen auf dem Konzept der Type Erasure. Die Generics sind nur Bestandteil der Java Sprache und werden demzufolge nur vom Java Compiler beachtet. Der compilierte Code kennt, salopp gesprochen, keine generische Typen sondern operiert auf dem vermuteten Basistypen der Generics.