directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r280425 - /directory/asn1/trunk/ber-new/src/test/org/apache/asn1new/util/MutableStringTest.java
Date Mon, 12 Sep 2005 21:25:05 GMT
Author: elecharny
Date: Mon Sep 12 14:25:00 2005
New Revision: 280425

URL: http://svn.apache.org/viewcvs?rev=280425&view=rev
Log:
Try to fix an encoding pb

Modified:
    directory/asn1/trunk/ber-new/src/test/org/apache/asn1new/util/MutableStringTest.java

Modified: directory/asn1/trunk/ber-new/src/test/org/apache/asn1new/util/MutableStringTest.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/ber-new/src/test/org/apache/asn1new/util/MutableStringTest.java?rev=280425&r1=280424&r2=280425&view=diff
==============================================================================
--- directory/asn1/trunk/ber-new/src/test/org/apache/asn1new/util/MutableStringTest.java (original)
+++ directory/asn1/trunk/ber-new/src/test/org/apache/asn1new/util/MutableStringTest.java Mon
Sep 12 14:25:00 2005
@@ -16,6 +16,8 @@
  */
 package org.apache.asn1new.util;
 
+import java.io.UnsupportedEncodingException;
+
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
@@ -43,13 +45,20 @@
      */
     public void testNonASCIIString()
     {
-        MutableString ms = new MutableString("Emmanuel Lécharny".getBytes());
-        String s = ms.toString();
-        
-        int msLength = ms.getLength();
-        int sLength = s.getBytes().length;
-        
-        Assert.assertEquals("Emmanuel Lécharny", s);   
-        Assert.assertEquals( sLength, msLength);
+        try 
+        {
+            MutableString ms = new MutableString("Emmanuel Lécharny".getBytes("UTF-8"));
+            String s = ms.toString();
+            
+            int msLength = ms.getLength();
+            int sLength = s.getBytes().length;
+            
+            Assert.assertEquals(new String("Emmanuel Lécharny".getBytes("UTF-8")) , s);
  
+            Assert.assertEquals( sLength, msLength);
+        }
+        catch ( UnsupportedEncodingException uee )
+        {
+            Assert.fail();
+        }
     }
 }



Mime
View raw message