-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adopt some asserts from assertj #3764
Comments
My two-biased-cents:
This is a general issue for any library that leverages fluent API. Certain IDEs like IntelliJ IDEA might help as they perform static analysis and immediately display unfinished assertions.
Since AssertJ is an assertion-focused library, what you get is vastly bigger than what JUnit offers today: bringing the same features into JUnit can be quite an effort. |
As stated several times in this issue tracker as well as in the User Guide, the JUnit team does not aim to compete with third-party assertion libraries.
In light of that, I am closing this issue. |
@scordio, there's a big difference between a fluent builder, which has an outcome the compiler can check (as in, forget to call build() and no object is assigned), and a fluent assertion that a developer can forget to complete, and that needs an additional tool to check (and that assumes the developer remembers to configure the additional tool). @sbrannen we had read your documentation and had seen that paragraph. We were simply asking you to reconsider. |
We don't use assertj because developers can forget to finish assertions (and their documentation even says as much: https://assertj.github.io/doc/#forgetting-to-call-an-assertion, and then says to work around that with static-analysis tools, which aren't needed with JUnit assertions).
However, there are some asserts in assertj that are really useful, for example isEqualToComparingFieldByFieldRecursively, which puts us in a bind. We wind up having to write rules that allow only certain uses of assertj, instead of just being able to Gradle exclude it entirely.
You could review the available assertj asserts and, for everything that requires extra work to achieve the same result in JUnit, add similar functionality to JUnit.
The text was updated successfully, but these errors were encountered: