geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r414880 - /geronimo/specs/trunk/geronimo-spec-javamail/src/test/java/javax/mail/internet/MimeUtilityTest.java
Date Fri, 16 Jun 2006 18:43:07 GMT
Author: rickmcguire
Date: Fri Jun 16 11:43:06 2006
New Revision: 414880

URL: http://svn.apache.org/viewvc?rev=414880&view=rev
Log:
GERONIMO-2130 javamail MimeUtilityTest fails on Mac OS/X


Modified:
    geronimo/specs/trunk/geronimo-spec-javamail/src/test/java/javax/mail/internet/MimeUtilityTest.java

Modified: geronimo/specs/trunk/geronimo-spec-javamail/src/test/java/javax/mail/internet/MimeUtilityTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-spec-javamail/src/test/java/javax/mail/internet/MimeUtilityTest.java?rev=414880&r1=414879&r2=414880&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-spec-javamail/src/test/java/javax/mail/internet/MimeUtilityTest.java
(original)
+++ geronimo/specs/trunk/geronimo-spec-javamail/src/test/java/javax/mail/internet/MimeUtilityTest.java
Fri Jun 16 11:43:06 2006
@@ -32,6 +32,8 @@
 
 public class MimeUtilityTest extends TestCase {
 
+    private byte[] encodeBytes = new byte[] { 32, 104, -61, -87, 33, 32, -61, -96, -61, -88,
-61, -76, 117, 32, 33, 33, 33 };
+
     public void testEncodeDecode() throws Exception {
 
         byte [] data = new byte[256];
@@ -86,31 +88,35 @@
 
     public void testEncodeWord() throws Exception {
         assertEquals("abc", MimeUtility.encodeWord("abc"));
+
+        String encodeString = new String(encodeBytes, "UTF-8");
         // default code page dependent, hard to directly test the encoded results
-        assertEquals(" hé! àèôu !!!", MimeUtility.decodeWord(MimeUtility.encodeWord("
hé! àèôu !!!")));
+        assertEquals(encodeString, MimeUtility.decodeWord(MimeUtility.encodeWord(encodeString)));
 
-        String encoded = MimeUtility.encodeWord(" hé! àèôu !!!", "UTF-8", "Q");
+        String encoded = MimeUtility.encodeWord(encodeString, "UTF-8", "Q");
         assertEquals("=?UTF-8?Q?_h=C3=A9!_=C3=A0=C3=A8=C3=B4u_!!!?=", encoded);
-        assertEquals(" hé! àèôu !!!", MimeUtility.decodeWord(encoded));
+        assertEquals(encodeString, MimeUtility.decodeWord(encoded));
 
-        encoded = MimeUtility.encodeWord(" hé! àèôu !!!", "UTF-8", "B");
+        encoded = MimeUtility.encodeWord(encodeString, "UTF-8", "B");
         assertEquals("=?UTF-8?B?IGjDqSEgw6DDqMO0dSAhISE=?=", encoded);
-        assertEquals(" hé! àèôu !!!", MimeUtility.decodeWord(encoded));
+        assertEquals(encodeString, MimeUtility.decodeWord(encoded));
     }
 
 
     public void testEncodeText() throws Exception {
         assertEquals("abc", MimeUtility.encodeWord("abc"));
+
+        String encodeString = new String(encodeBytes, "UTF-8");
         // default code page dependent, hard to directly test the encoded results
-        assertEquals(" hé! àèôu !!!", MimeUtility.decodeText(MimeUtility.encodeText("
hé! àèôu !!!")));
+        assertEquals(encodeString, MimeUtility.decodeText(MimeUtility.encodeText(" hé! àèôu
!!!")));
 
-        String encoded = MimeUtility.encodeText(" hé! àèôu !!!", "UTF-8", "Q");
+        String encoded = MimeUtility.encodeText(encodeString, "UTF-8", "Q");
         assertEquals("=?UTF-8?Q?_h=C3=A9!_=C3=A0=C3=A8=C3=B4u_!!!?=", encoded);
-        assertEquals(" hé! àèôu !!!", MimeUtility.decodeText(encoded));
+        assertEquals(encodeString, MimeUtility.decodeText(encoded));
 
-        encoded = MimeUtility.encodeText(" hé! àèôu !!!", "UTF-8", "B");
+        encoded = MimeUtility.encodeText(encodeString, "UTF-8", "B");
         assertEquals("=?UTF-8?B?IGjDqSEgw6DDqMO0dSAhISE=?=", encoded);
-        assertEquals(" hé! àèôu !!!", MimeUtility.decodeText(encoded));
+        assertEquals(encodeString, MimeUtility.decodeText(encoded));
     }
 
 



Mime
View raw message