You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/06/19 20:39:35 UTC

[GitHub] [commons-lang] kinow commented on a diff in pull request #913: remove some duplicate assertion in StringUtilsTest

kinow commented on code in PR #913:
URL: https://github.com/apache/commons-lang/pull/913#discussion_r901153942


##########
src/test/java/org/apache/commons/lang3/StringUtilsTest.java:
##########
@@ -1623,13 +1622,9 @@ public void testReCapitalize() {
     public void testRemove_char() {
         // StringUtils.remove(null, *)       = null
         assertNull(StringUtils.remove(null, 'a'));
-        assertNull(StringUtils.remove(null, 'a'));
-        assertNull(StringUtils.remove(null, 'a'));
 
         // StringUtils.remove("", *)          = ""
         assertEquals("", StringUtils.remove("", 'a'));
-        assertEquals("", StringUtils.remove("", 'a'));
-        assertEquals("", StringUtils.remove("", 'a'));

Review Comment:
   This method, `testRemove_char`, appears to have been based off the `testRemove_String`. You are correct these three statements are duplicated and can be removed. But in `testRemove_String` there's one test case that must be added here as well:
   
   ```
   assertNull(StringUtils.remove(null, null));
   &
   assertEquals("", StringUtils.remove("", null));
   ```
   
   Can you add them, please, @shalk ?



##########
src/test/java/org/apache/commons/lang3/StringUtilsTest.java:
##########
@@ -2774,7 +2769,6 @@ public void testSplitPreserveAllTokens_StringChar() {
         assertEquals("b", res[1]);
         assertEquals("c", res[2]);
         assertEquals("", res[3]);
-        assertEquals("", res[3]);

Review Comment:
   I believe this was supposed to be `assertEquals("", res[4]);`. The other tests have a similar case, where they verify the indexes from `0` to the last index available (`4` in this case). Can you change it, please?



-- 
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: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org