error-prone-support
error-prone-support copied to clipboard
AssertJ Refaster rules for `Iterator#hasNext()`
Running the JUnitToAssertJRules
across some code I noticed that AssertThatIsTrue
and AssertThatIsFalse
transformed some JUnit assertTrue()
and assertFalse()
calls:
It seems like it would be a nice addition to have specific rules calling AbstractIteratorAssert#hasNext()
and AbstractIteratorAssert#isExhausted()
instead.
The example was found in hibernate/hibernate-tools: https://github.com/hibernate/hibernate-tools/blob/10431fc27866d295be9d2062ffdc9b1cd9099c16/jbt/src/test/java/org/hibernate/tool/orm/jbt/util/NativeConfigurationTest.java#L242-L247
I suppose there would be a lot more interesting rules of this type that could be added. String#contains(CharSequence)
comes to mind.
Adding these type of rules to AssertJRules
probably makes more sense.