cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r939664 - /cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProviderTest.java
Date Fri, 30 Apr 2010 13:33:35 GMT
Author: sergeyb
Date: Fri Apr 30 13:33:35 2010
New Revision: 939664

URL: http://svn.apache.org/viewvc?rev=939664&view=rev
Log:
Fixing JAXRS test, verified on Linux

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProviderTest.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProviderTest.java?rev=939664&r1=939663&r2=939664&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProviderTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProviderTest.java
Fri Apr 30 13:33:35 2010
@@ -21,6 +21,7 @@ package org.apache.cxf.jaxrs.provider;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.nio.charset.Charset;
 import java.util.Arrays;
 
 import javax.ws.rs.core.MediaType;
@@ -105,10 +106,21 @@ public class PrimitiveTextProviderTest e
         MessageBodyWriter p = new PrimitiveTextProvider();
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         MultivaluedMap<String, Object> headers = new MetadataMap<String, Object>();
-        p.writeTo("Hello, my name is Félix Agnès", 
+        
+        String eWithAcute = "\u00E9";
+        String helloStringUTF16 = "Hello, my name is F" + eWithAcute + "lix Agn" + eWithAcute
+ "s";
+        
+        p.writeTo(helloStringUTF16, 
                   String.class, String.class, null, MediaType.valueOf("text/plain;charset=ISO-8859-1"),
                   headers, os);
-        assertEquals("Hello, my name is Félix Agnès", os.toString("ISO-8859-1")); 
+        
+        Charset iso88591charset = Charset.forName("ISO-8859-1");
+        byte[] iso88591bytes = helloStringUTF16.getBytes(iso88591charset);
+        String helloStringISO88591 = new String(iso88591bytes, iso88591charset);
+        
+        System.out.println(helloStringISO88591);
+        
+        assertEquals(helloStringISO88591, os.toString("ISO-8859-1")); 
     }
     
         



Mime
View raw message