prop
Returns an assert that asserts on the given property of the value.
Parameters
name
The name of the property to show in failure messages.
extract
The function to extract the property value out of the value of the current assert.
assertThat(person).prop("name", { it.name }).isEqualTo("Sue")
Content copied to clipboard
Returns an assert that asserts on the given property.
Example:
assertThat(person).prop(Person::name).isEqualTo("Sue")
Content copied to clipboard
Parameters
property
Property on which to assert. The name of this property will be shown in failure messages.
Returns an assert that asserts on the result of calling the given function.
Example:
assertThat(person).prop(Person::nameAsLowerCase).isEqualTo("sue")
Content copied to clipboard
Parameters
callable
Callable on which to assert. The name of this callable will be shown in the failure messages.