let me thank you first for your work. Because I was looking a long time that we can use records with AssertJ and can remove the templates.
The new version works perfectly in our project. Unfortunately, I found a bug with M4/M5. But maybe isn't bug, because our clever programming isn't that clever ;). Should I open an issue for that?
/**
* Verifies that the actual Data's id is equal to the given one.
* @param id the given id to compare the actual Data's id to.
* @return this assertion object.
* @throws AssertionError - if the actual Data's id is not equal to the given one.
*/
public S hasId(String id) {
// check that actual Data we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting id of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
String actualId = actual.getId();
if (!Objects.deepEquals(actualId, id)) {
failWithMessage(assertjErrorMessage, actual, id, actualId);
}
// return the current assertion for method chaining
return myself;
}
/**
* Verifies that the actual Data's id is equal to the given one.
* @param id the given id to compare the actual Data's id to.
* @return this assertion object.
* @throws AssertionError - if the actual Data's id is not equal to the given one.
*/
public S hasId(String id) {
// check that actual Data we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting id of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
String actualId = actual.id();
if (!Objects.deepEquals(actualId, id)) {
failWithMessage(assertjErrorMessage, actual, id, actualId);
}
// return the current assertion for method chaining
return myself;
}
Originally posted by @schmuka0501 in assertj/assertj-assertions-generator-maven-plugin#93 (comment)