Thursday, November 23, 2017

JUnit 5 meets AssertJ

JUnit 5 brings a lot of improvements in the assertions library, mainly thanks to Java 8 and Lambda Expression support and thanks to the presence of the new assertions like assertAll, assertTimeout orassertThrows. Although I really like JUnit 5 I believe that AssertJ is still a must in production grade unit tests and I will continue using it.

But I think there are potential scenarios of mixing both JUnit 5 and AssertJ in single unit test: one of them is mixing JUnit assertAll with AssertJ assertThat.