-
-
Notifications
You must be signed in to change notification settings - Fork 766
#3458 isUnmodifiable assertion for Iterator instances #3477
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
Conversation
scordio
left a comment
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 @dehasi, here are some comments. The build is failing due to the usage of Java 9+ API (List.of).
assertj-core/src/main/java/org/assertj/core/api/AbstractIteratorAssert.java
Show resolved
Hide resolved
assertj-core/src/main/java/org/assertj/core/api/AbstractIteratorAssert.java
Outdated
Show resolved
Hide resolved
...rtj-core/src/test/java/org/assertj/core/api/iterator/IteratorAssert_isUnmodifiable_Test.java
Outdated
Show resolved
Hide resolved
...rtj-core/src/test/java/org/assertj/core/api/iterator/IteratorAssert_isUnmodifiable_Test.java
Outdated
Show resolved
Hide resolved
...rtj-core/src/test/java/org/assertj/core/api/iterator/IteratorAssert_isUnmodifiable_Test.java
Outdated
Show resolved
Hide resolved
...rtj-core/src/test/java/org/assertj/core/api/iterator/IteratorAssert_isUnmodifiable_Test.java
Outdated
Show resolved
Hide resolved
assertj-core/src/main/java/org/assertj/core/api/AbstractIteratorAssert.java
Show resolved
Hide resolved
|
@scordio I've squashed my changes. I think I can only struggle if the target branch is changed, and I might need assistance. Just afraid to mess with Git 🫤 |
|
This is now merged. Thanks for your first contribution, @dehasi! |
Check List:
isUnmodifiableassertion forIteratorinstances #3458Following the contributing guidelines will make it easier for us to review and accept your PR.
What was done
I can only check if an iterator is unmodifiable by calling
remove()and checking if the iterator throwsUnsupportedOperationException. However not all unmodifiable iterators behave like that, see my comment in the ticket.That's why I check explicitly for
Collections$EmptyIteratorandCollections$EmptyListIterator.cc @scordio