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
Add hasRecordComponents() Class assertion #2995
Add hasRecordComponents() Class assertion #2995
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ljrmorgan, just two comments
assertj-core/src/main/java/org/assertj/core/api/AbstractClassAssert.java
Outdated
Show resolved
Hide resolved
assertj-core/src/main/java/org/assertj/core/error/ShouldHaveRecordComponents.java
Outdated
Show resolved
Hide resolved
Thanks for reviewing @scordio! I was trying to copy the behaviour of I'm less sure about adding a Thanks! |
That could work, or also keeping a single vararg but making sure it's not null and has at least one element, checks that can be done in the method body.
Fair enough, nothing prevents us to add it later if users come back with a concrete use case. For now, let's skip it. |
Change hasRecordComponents() to require at least one record component to be passed in
aa62a4a
to
2bbc02b
Compare
# Conflicts: # assertj-core/src/main/java/org/assertj/core/api/AbstractClassAssert.java
This is now merged. Thanks, @ljrmorgan! |
Check List:
Add a
hasRecordComponents()
Class assertion, following on from #2968.I've tried to take a similar approach to assertions like
hasPublicFields()
, but as withisRecord()
andisNotRecord()
I've left the implementation of the assertion inAbstractClassAssert
rather than extracting it toClasses
.