Copilot commented on code in PR #763:
URL: https://github.com/apache/commons-text/pull/763#discussion_r3682156556
##########
src/test/java/org/apache/commons/text/StrBuilderTest.java:
##########
@@ -1219,6 +1220,9 @@ void testLastIndexOf_String() {
assertEquals(-1, sb.lastIndexOf("z"));
assertEquals(-1, sb.lastIndexOf((String) null));
+
+ assertEquals(4, sb.lastIndexOf(""));
+ assertEquals("".lastIndexOf(""), new StringBuilder().lastIndexOf(""));
Review Comment:
These new assertions introduce a magic number and the second line only
checks JDK behavior, not StrBuilder. To keep the test consistent with the
existing "should work like String#lastIndexOf" assertions, compare StrBuilder
to the equivalent String result.
##########
src/test/java/org/apache/commons/text/TextStringBuilderTest.java:
##########
@@ -1394,6 +1394,9 @@ void testLastIndexOf_String() {
assertEquals(-1, sb.lastIndexOf("z"));
assertEquals(-1, sb.lastIndexOf((String) null));
+
+ assertEquals(4, sb.lastIndexOf(""));
+ assertEquals("".lastIndexOf(""), new StringBuilder().lastIndexOf(""));
Review Comment:
The new assertions don’t follow the rest of this test’s pattern (comparing
to String#lastIndexOf) and the second assertion only validates JDK behavior,
not TextStringBuilder. Consider asserting TextStringBuilder against the
equivalent String result to avoid a magic number and keep the test focused on
the class under test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]