You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// check assertion logicif (!Objects.equals(actual.getName(), name)) {
failWithMessage("Expected character's name to be <%s> but was <%s>", name, actual.getName());
}
I would expect to reuse existing String assertions there, e.g. to write this instead:
// check assertion logicAssertions.assertThat(actual.getName)
.withFailMessage(() -> "Expected character's name to be <%s> but was <%s>", name, actual.getName())
.isEqualTo(name);
Is there a good reason to not use other existing assertions there (like confusing the logic to shorten stack traces or similar internal things)? If yes, can we please document it? Otherwise, shouldn't we change the example code?
I typically do use existing assertions in my own assertions, and I have this nagging feeling of doing something wrong without knowing what exactly. :)
The text was updated successfully, but these errors were encountered:
https://assertj.github.io/doc/#assertj-core-custom-assertions-creation shows how to create custom assertion classes. One part that I find very confusing is this piece of code in the custom
hasName
assertion implementation:I would expect to reuse existing String assertions there, e.g. to write this instead:
Is there a good reason to not use other existing assertions there (like confusing the logic to shorten stack traces or similar internal things)? If yes, can we please document it? Otherwise, shouldn't we change the example code?
I typically do use existing assertions in my own assertions, and I have this nagging feeling of doing something wrong without knowing what exactly. :)
The text was updated successfully, but these errors were encountered: