You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by gg...@apache.org on 2003/12/11 23:17:22 UTC

cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang CharSetUtilsTest.java

ggregory    2003/12/11 14:17:22

  Modified:    lang/src/test/org/apache/commons/lang CharSetUtilsTest.java
  Log:
  Record behavior in a test for From http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25454.
  
  Revision  Changes    Path
  1.15      +22 -8     jakarta-commons/lang/src/test/org/apache/commons/lang/CharSetUtilsTest.java
  
  Index: CharSetUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/CharSetUtilsTest.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- CharSetUtilsTest.java	19 Aug 2003 00:21:46 -0000	1.14
  +++ CharSetUtilsTest.java	11 Dec 2003 22:17:22 -0000	1.15
  @@ -67,6 +67,7 @@
    * @author <a href="mailto:bayard@generationjava.com">Henri Yandell</a>
    * @author <a href="mailto:ridesmet@users.sourceforge.net">Ringo De Smet</a>
    * @author Stephen Colebourne
  + * @author Gary D. Gregory
    * @version $Id$
    */
   public class CharSetUtilsTest extends TestCase {
  @@ -270,31 +271,44 @@
           assertEquals("heo", CharSetUtils.delete("hello", new String[] { "l" }));
       }
       
  -    //-----------------------------------------------------------------------
  +    
       public void testTranslate() {
           assertEquals(null, CharSetUtils.translate(null, null, null));
  -        assertEquals("", CharSetUtils.translate("","a", "b"));
  +        assertEquals("", CharSetUtils.translate("", "a", "b"));
           assertEquals("jelly", CharSetUtils.translate("hello", "ho", "jy"));
           assertEquals("jellj", CharSetUtils.translate("hello", "ho", "j"));
           assertEquals("jelly", CharSetUtils.translate("hello", "ho", "jyx"));
           assertEquals("\rhello\r", CharSetUtils.translate("\nhello\n", "\n", "\r"));
           assertEquals("hello", CharSetUtils.translate("hello", "", "x"));
           assertEquals("hello", CharSetUtils.translate("hello", "", ""));
  +        assertEquals("hello", CharSetUtils.translate("hello", "", ""));
  +        // From http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25454
  +        assertEquals("q651.506bera", CharSetUtils.translate("d216.102oren", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789",
  +                "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM567891234"));
  +    }
  +
  +    public void testTranslateNullPointerException() {
           try {
               CharSetUtils.translate("hello", null, null);
               fail("Expecting NullPointerException");
  -        } catch (NullPointerException ex) {}
  +        } catch (NullPointerException ex) {
  +        }
           try {
               CharSetUtils.translate("hello", "h", null);
               fail("Expecting NullPointerException");
  -        } catch (NullPointerException ex) {}
  +        } catch (NullPointerException ex) {
  +        }
           try {
               CharSetUtils.translate("hello", null, "a");
               fail("Expecting NullPointerException");
  -        } catch (NullPointerException ex) {}
  +        } catch (NullPointerException ex) {
  +        }
           try {
               CharSetUtils.translate("hello", "h", "");
               fail("Expecting ArrayIndexOutOfBoundsException");
  -        } catch (ArrayIndexOutOfBoundsException ex) {}
  -    }         
  +        } catch (ArrayIndexOutOfBoundsException ex) {
  +        }
  +    }
  +         
  +    
   }
  
  
  

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