templates.is_assertion_template.txt Maven / Gradle / Ivy
/**
* Verifies that the actual ${class_to_assert} is ${property}.
* @return this assertion object.
* @throws AssertionError - if the actual ${class_to_assert} is not ${property}.
*/
public ${class_to_assert}Assert is${Property}() {
// check that actual ${class_to_assert} we want to make assertions on is not null.
isNotNull();
// we overrides the default error message with a more explicit one
String errorMessage = format("Expected actual ${class_to_assert} to be ${property} but was not.", actual);
// check
if (!actual.is${Property}()) throw new AssertionError(errorMessage);
// return the current assertion for method chaining
return this;
}