commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang StringUtilsTest.java
Date Wed, 29 Oct 2003 02:16:30 GMT
ggregory    2003/10/28 18:16:30

  Modified:    lang/src/test/org/apache/commons/lang StringUtilsTest.java
  Log:
  Added  public static String removeEnd(String str, String remove).
  
  Revision  Changes    Path
  1.54      +18 -3     jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java
  
  Index: StringUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- StringUtilsTest.java	29 Oct 2003 01:50:14 -0000	1.53
  +++ StringUtilsTest.java	29 Oct 2003 02:16:30 -0000	1.54
  @@ -277,8 +277,6 @@
           assertEquals("foo2", StringUtils.concatenate(MIXED_TYPE_LIST));
       }
           
  -        
  -
       public void testSplit_String() {
           assertEquals(null, StringUtils.split(null));
           assertEquals(0, StringUtils.split("").length);
  @@ -1002,6 +1000,23 @@
           assertEquals(StringUtils.removeStart("www.domain.com", "www."), "domain.com");
           assertEquals(StringUtils.removeStart("domain.com", "www."), "domain.com");
           assertEquals(StringUtils.removeStart("domain.com", ""), "domain.com");        
  +    }
  +
  +    public void testRemoveEnd() {
  +        // StringUtils.removeEnd("", *)        = ""
  +        assertNull(StringUtils.removeEnd(null, null));
  +        assertNull(StringUtils.removeEnd(null, ""));
  +        assertNull(StringUtils.removeEnd(null, "a"));
  +        
  +        // StringUtils.removeEnd(*, null)      = *
  +        assertEquals(StringUtils.removeEnd("", null), "");
  +        assertEquals(StringUtils.removeEnd("", ""), "");
  +        assertEquals(StringUtils.removeEnd("", "a"), "");
  +        
  +        // All others:
  +        assertEquals(StringUtils.removeEnd("www.domain.com", ".com"), "www.domain");
  +        assertEquals(StringUtils.removeEnd("www.domain", ".com"), "www.domain");
  +        assertEquals(StringUtils.removeEnd("domain.com", ""), "domain.com");   
       }
   }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message