Cheaper by the dozen

May it be an assertion more? - AssertJ for test success

Hopefully writing unit tests is an integral part of the developers working routine by now. But these tests are only useful, if there is at least one assertion per test. Even modern IDEs and static code analysis tools remind you, should there be a missing assertion for a test.

In the Java world JUnit5 and TestNG are the two most wide spread Unit-Test frameworks. Both of them come with their own basic implementations for assertions and marchers. Like “assertEquals”, “assertNull” or “assertTrue”, just to name a few. But as soon, as the check of the test results gets more complex, it easily becomes quite cumbersome and hard to write such assertions.

This is the point where libraries with more specialised assertions and matchers enter the field.
One such library is AssertJ.
In this talk I want to give you a brief introduction to AssertJ. I will use lots of code examples, which show how to make the writing of simple and complex assertions easy, more readable and even fun. And when you have fun, you want to do more of it.
Your code coverage will be the winner.

Date
16.03.2022 17:00 — 17:40
Location
Phantasialand, Brühl
Birgit Kratz
Birgit Kratz
Softwarecrafter

Softwarearchitect and Developer Java, SpringBoot, Clean Code, Agile