Hi everyone, I was wondering what the appetite would be for introducing
AssertJ <https://assertj.github.io/doc/> to the project? I believe it's a
really good testing library that makes writing assertions much more
intuitive, as the assertions are written in a fluent way. The test code
ends up being more readable and it provides an actually useful error
message when assertions fail.
There are some good examples of how AssertJ is used here
<https://assertj.github.io/doc/#assertj-core-assertions-guide>, but
personally what I like most about AssertJ is testing exceptional code
<https://assertj.github.io/doc/#assertj-core-exception-assertions-assertThatThrownBy>,
where you want to ensure some code throws a particular exception and also
has message *Xyz* or some other property that you want to assert on.
No more *@Test(expected = SomeException.class)* or *try-catch* code with
*Assert.fail()*.
Also we've been successfully using it in the Apache Iceberg project for
many years, and it has improved how we write tests.
  I took the liberty of opening PR #3617
<https://github.com/apache/parquet-java/pull/3617>, which introduces
AssertJ to a subset of tests just to show its usage and benefits.
The idea is to give people a (better) alternative when testing certain
things, such as collections, exceptions, paths, URIs and so on. People can
still use JUnit assertions if they want to, but at least there's an option
to use other assertions if needed for cases that are more difficult to
express/do with JUnit assertions.
Please let me know what you think Eduard

Reply via email to