Copilot commented on code in PR #1809:
URL: https://github.com/apache/commons-lang/pull/1809#discussion_r4264636886


##########
src/test/java/org/apache/commons/lang3/StringUtilsTest.java:
##########
@@ -1410,6 +1410,8 @@ void testLowerCase() {
     void testNormalizeSpace() {
         // Java says a non-breaking whitespace is not a whitespace.
         assertFalse(Character.isWhitespace('\u00A0'));
+        assertEquals("a\u00A0b", StringUtils.normalizeSpace("a\u00A0b"));
+        assertEquals("a\u00A0 b", StringUtils.normalizeSpace("a\u00A0 b"));

Review Comment:
   These assertions embed `\\u00A0` directly in string literals, which can be 
harder to scan and maintain compared to using the existing `HARD_SPACE` test 
constant. Consider rewriting expected strings using `HARD_SPACE` (e.g., 
concatenation like `\"a\" + HARD_SPACE + \"b\"` / `\"a \" + HARD_SPACE + 
HARD_SPACE + \"b c\"`) to keep the intent explicit and consistent across the 
test.



##########
src/test/java/org/apache/commons/lang3/StringUtilsTest.java:
##########
@@ -1428,7 +1430,7 @@ void testNormalizeSpace() {
         assertEquals("a", StringUtils.normalizeSpace("  a  "));
         assertEquals("a b c", StringUtils.normalizeSpace("  a  b   c  "));
         assertEquals("a b c", StringUtils.normalizeSpace("a\t\f\r  b\u000B   
c\n"));
-        assertEquals("a   b c", StringUtils.normalizeSpace("a\t\f\r  " + 
HARD_SPACE + HARD_SPACE + "b\u000B   c\n"));
+        assertEquals("a \u00A0\u00A0b c", StringUtils.normalizeSpace("a\t\f\r  
" + HARD_SPACE + HARD_SPACE + "b\u000B   c\n"));

Review Comment:
   These assertions embed `\\u00A0` directly in string literals, which can be 
harder to scan and maintain compared to using the existing `HARD_SPACE` test 
constant. Consider rewriting expected strings using `HARD_SPACE` (e.g., 
concatenation like `\"a\" + HARD_SPACE + \"b\"` / `\"a \" + HARD_SPACE + 
HARD_SPACE + \"b c\"`) to keep the intent explicit and consistent across the 
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]

Reply via email to