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 isRecord
and isNotRecord
to Class
assertions
#2968
Conversation
Thanks @ljrmorgan, this one is better targeted to assertj 4.0 which will use java 17 |
Thanks @joel-costigliola! A Java 17 baseline would also remove all the reflection code, which would be great. Is there a |
assertj-core/src/main/java/org/assertj/core/api/AbstractClassAssert.java
Outdated
Show resolved
Hide resolved
assertj-core/src/main/java/org/assertj/core/api/AbstractClassAssert.java
Outdated
Show resolved
Hide resolved
assertj-core/src/main/java/org/assertj/core/internal/Classes.java
Outdated
Show resolved
Hide resolved
assertj-core/src/main/java/org/assertj/core/internal/Classes.java
Outdated
Show resolved
Hide resolved
assertj-core/src/test/java/org/assertj/core/api/classes/ClassAssert_isRecord_Test.java
Outdated
Show resolved
Hide resolved
Not yet but as I mentioned I still think we could ship this in 3.x and change the implementation in 4.x. @joel-costigliola how do you see it? |
I can live with that |
3f2c240
to
ab770d6
Compare
Thanks for your first contribution, @ljrmorgan! |
isRecord
and isNotRecord
to Class
assertions
Check List:
Add
isRecord()
andisNotRecord()
Class assertions.As
record
only landed in Java 16 I'm having to use reflection to check whether the class is a record or not. I'm also only able to add unit tests for the negative cases, because I can't compile code that usesrecord
.If this is accepted I thought I'd also open a PR that adds a
hasRecordComponents
assertion.