Skip to content
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

Improve assertion description for hasValidGettersAndSettersExcluding("…") #19

Open
netsrotr opened this issue Feb 25, 2020 · 1 comment

Comments

@netsrotr
Copy link

netsrotr commented Feb 25, 2020

Suggestion

Change the assertion description returned on fail for assertThat(BeanToTest.class, hasValidGettersAndSettersExcluding("dontTestPropertyWithThisName")) to list the expected properties, not the already known (and yet provided) excluded properties list.

We use assertions of this kind very often, because of many read-only properties:
assertThat(BeanToTest.class, hasValidGettersAndSettersExcluding("dontTestPropertyWithThisName"))
The current behavior: if assertion matcher fail, it list the the already known (and yet provided) excluded properties list within the fail-description.

This information is redundant and does not really help to exactly point/describe the issue: one or more properties have no valid setters/getters, but which of the remaining at the class under test?
Expected behavior: it should instead list the properties that are found by the "magic" JavaBean (with the excluded properties subtracted). This information would really help test developers to track down to the point.

@orien orien changed the title Suggestion: change the assertion description returned on fail for assertThat(BeanToTest.class, hasValidGettersAndSettersExcluding("dontTestPropertyWithThisName")) to list the expected properties, not the already known (and yet provided) excluded properties list Improve assertion description for hasValidGettersAndSettersExcluding("…") Jan 9, 2021
@orien
Copy link
Owner

orien commented Jan 9, 2021

Thanks @netsrotr, this is a good suggestion. Would you like to submit a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants