commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject cvs commit: jakarta-commons-sandbox/lang/src/test/org/apache/commons/lang StringsTrimEmptyTest.java
Date Tue, 09 Jul 2002 07:31:19 GMT
bayard      2002/07/09 00:31:18

  Modified:    lang/src/test/org/apache/commons/lang
                        StringsTrimEmptyTest.java
  Log:
  Added the strip methods to here as they are trim-like.
  
  Revision  Changes    Path
  1.3       +38 -1     jakarta-commons-sandbox/lang/src/test/org/apache/commons/lang/StringsTrimEmptyTest.java
  
  Index: StringsTrimEmptyTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/lang/src/test/org/apache/commons/lang/StringsTrimEmptyTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringsTrimEmptyTest.java	8 Jul 2002 21:48:30 -0000	1.2
  +++ StringsTrimEmptyTest.java	9 Jul 2002 07:31:18 -0000	1.3
  @@ -122,4 +122,41 @@
           assertEquals(true, Strings.isEmpty(null));
       }
   
  +    public void testStrip() {
  +        // it's important that foo2Space is fooLeftSpace and fooRightSpace 
  +        // merged together. So same number of spaces to left as fLS and same 
  +        // to right as fLS. Same applies for foo2Dots.
  +        String foo2Space = "    "+FOO+"    ";
  +        String foo2Dots = "......"+FOO+".........";
  +        String fooLeftSpace = "    "+FOO;
  +        String fooLeftDots = "......"+FOO;
  +        String fooRightSpace = FOO+"    ";
  +        String fooRightDots = FOO+".........";
  +
  +        assertEquals("", Strings.strip(""));
  +        assertEquals(FOO, Strings.strip(foo2Space));
  +        assertEquals(FOO, Strings.strip(foo2Dots, "."));
  +        assertEquals(FOO, Strings.strip(fooRightSpace));
  +        assertEquals(FOO, Strings.strip(fooRightDots, "."));
  +        assertEquals(FOO, Strings.strip(fooLeftSpace));
  +        assertEquals(FOO, Strings.strip(fooLeftDots, "."));
  +
  +        assertEquals("", Strings.stripStart("", " "));
  +        assertEquals(fooRightSpace, Strings.stripStart(foo2Space, " "));
  +        assertEquals(fooRightDots, Strings.stripStart(foo2Dots, "."));
  +        assertEquals(fooRightSpace, Strings.stripStart(fooRightSpace, " "));
  +        assertEquals(fooRightDots, Strings.stripStart(fooRightDots, "."));
  +        assertEquals(FOO, Strings.stripStart(fooLeftSpace, " "));
  +        assertEquals(FOO, Strings.stripStart(fooLeftDots, "."));
  +
  +        assertEquals("", Strings.stripEnd("", " "));
  +        assertEquals(fooLeftSpace, Strings.stripEnd(foo2Space, " "));
  +        assertEquals(fooLeftDots, Strings.stripEnd(foo2Dots, "."));
  +        assertEquals(FOO, Strings.stripEnd(fooRightSpace, " "));
  +        assertEquals(FOO, Strings.stripEnd(fooRightDots, "."));
  +        assertEquals(fooLeftSpace, Strings.stripEnd(fooLeftSpace, " "));
  +        assertEquals(fooLeftDots, Strings.stripEnd(fooLeftDots, "."));
  +
  +    }
  +
   }
  
  
  

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


Mime
View raw message