FreshMarker Version Variable Fixes

FreshMarker is strongly characterised by KISS and YAGNI. This makes the template engine lean and yet powerful. But in some places, the simplicity leads to careless mistakes.

In the first versions, the system variable .version was defined as a constant for the FreshMarker version. Unfortunately, this meant that the version number was regularly forgotten to be updated before the release.

In-Memory Temp Folder in JUnit 5

Java Bibliotheken

While implementing some tests for the Freshmarker 1.0.0 release, I discovered another interesting possibility for a JUnit 5 TempDirFactory implementation. But first things first.

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.

Custom Temp Folders in JUnit 5

Java Bibliotheken

It is always instructive to look at well-known open source projects to learn from the implementation used. Sometimes you look at the unit tests and start to wonder. A serious problem with large and old frameworks is the time-consuming adaptation to changing environments. Modern features in libraries such as JUnit 5 simplify the code base immensely.

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.

Statische Methoden mocken mit Mockito

Java Bibliotheken

Hin und wieder entdeckt man als Software Entwickler ein Feature in einer Bibliothek wieder, dass man schon zweimal vergessen hat. Wenn man dieses wiederentdeckte Wissen mit einem Kollegen teilen kann, dann ist es nicht nur schön sondern verbessert auch noch die Qualität der täglichen Arbeit.

Camunda und JUnit 5

Schon im Beitrag Stammbaumprüfung mit BPMN wurde der Einsatz von BPMN Workflows in einer Workflow-Engine vorgestellt. Im damaligen Beitrag wurde die Workflow-Engine Flowable verwendet. In diesem Beitrag dreht es sich um die Workflow-Engine Camunda. Wer eine neuen Workflow erstellt hat, möchte diesen natürlich auch gerne im Vorfeld testen. Dafür stellt auch Camunda eine JUnit 5 Unterstützung bereit.

Unit Tests, die Maurerschnur der Software Entwickler

Das Zitat „Die Unit Tests schreibe ich immer zum Schluss“ hat vermutlich schon jeder Entwickler von einem Kollegen hören müssen. Üblicherweise, wenn man bei einem schwerwiegenden Problem während der Implementierung helfen möchte. Ein kurzer Blick auf die Testergebnisse hilft dann enorm. Häufig zeigen die fehlgeschlagenen Unit Test direkt auf das Problem. Fehlen die Unit Tests, dann müssen sich die Entwickler solange durch GIT Historie und Debugger quälen, bis der eingeschleppte Fehler gefunden ist.

Mockito – Der Spion der mich hasste

Die Bibliothek Mockito ist in der Test-Driven Software Entwicklung kaum noch wegzudenken. Die Möglichkeit komplexe Interaktionen mit APIs durch Mocks simulieren zu lassen, vereinfacht und beschleunigt die Implementierung eigener Anwendungen. Leider gibt es aber immer wieder kleine Stolperfallen in der Verwendung dieses ansonsten hervorragenden Framework.