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

Add isRecord and isNotRecord to Class assertions #2968

Merged
merged 3 commits into from Mar 2, 2023

Conversation

ljrmorgan
Copy link
Contributor

Check List:

Add isRecord() and isNotRecord() 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 uses record.

If this is accepted I thought I'd also open a PR that adds a hasRecordComponents assertion.

@joel-costigliola
Copy link
Member

Thanks @ljrmorgan, this one is better targeted to assertj 4.0 which will use java 17

@joel-costigliola joel-costigliola added this to the 4.0.0 milestone Feb 28, 2023
@ljrmorgan
Copy link
Contributor Author

Thanks @joel-costigliola! A Java 17 baseline would also remove all the reflection code, which would be great. Is there a 4.x branch or anything that I could rebase onto?

@scordio
Copy link
Member

scordio commented Feb 28, 2023

A Java 17 baseline would also remove all the reflection code, which would be great. Is there a 4.x branch or anything that I could rebase onto?

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?

@joel-costigliola
Copy link
Member

I can live with that

@scordio scordio modified the milestones: 4.0.0, 3.25.0 Feb 28, 2023
@scordio scordio added the language: Java 17+ An issue related to using AssertJ with Java 17 or newer label Feb 28, 2023
@scordio scordio self-assigned this Mar 1, 2023
@scordio scordio merged commit 943a167 into assertj:main Mar 2, 2023
@scordio
Copy link
Member

scordio commented Mar 2, 2023

Thanks for your first contribution, @ljrmorgan!

@scordio scordio changed the title Add isRecord() and isNotRecord() Class assertions Add isRecord and isNotRecord to Class assertions Mar 2, 2023
@ljrmorgan ljrmorgan deleted the add_is_record_assertion branch March 22, 2023 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language: Java 17+ An issue related to using AssertJ with Java 17 or newer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants