geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1743416 - /geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/internet/ContentTypeTest.java
Date Wed, 11 May 2016 19:18:45 GMT
Author: adc
Date: Wed May 11 19:18:45 2016
New Revision: 1743416

URL: http://svn.apache.org/viewvc?rev=1743416&view=rev
Log:
Fix testToString()

Modified:
    geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/internet/ContentTypeTest.java

Modified: geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/internet/ContentTypeTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/internet/ContentTypeTest.java?rev=1743416&r1=1743415&r2=1743416&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/internet/ContentTypeTest.java
(original)
+++ geronimo/specs/trunk/geronimo-javamail_1.5_spec/src/test/java/javax/mail/internet/ContentTypeTest.java
Wed May 11 19:18:45 2016
@@ -19,6 +19,10 @@
 
 package javax.mail.internet;
 
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
 import junit.framework.TestCase;
 
 /**
@@ -98,7 +102,17 @@ public class ContentTypeTest extends Tes
         type.setParameter("foo", "bar");
         assertEquals("text/plain; foo=bar", type.toString());
         type.setParameter("bar", "me@apache.org");
-        assertEquals("text/plain; foo=bar; bar=\"me@apache.org\"", type.toString());
+
+        String[] tokens = type.toString().split(";");
+        assertEquals(3, tokens.length);
+
+        Set<String> parameters = new HashSet<String>();
+        for (String s : tokens) {
+            parameters.add(s.replaceAll("\\s+",""));
+        }
+        assertTrue(parameters.contains("text/plain"));
+        assertTrue(parameters.contains("foo=bar"));
+        assertTrue(parameters.contains("bar=\"me@apache.org\""));
     }
     public void testMatchContentType() throws ParseException {
         final ContentType type = new ContentType("text/plain");



Mime
View raw message