[FILEUPLOAD-232] started importing MimeUtility test case from http://svn.apache.org/repos/asf/geronimo/specs/tags/geronimo-javamail_1.4_spec-1.4/src/test/java/javax/mail/internet/MimeUtilityTest.java

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/fileupload/trunk@1457788 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/test/java/org/apache/commons/fileupload/utils/mime/MimeUtilityTestCase.java b/src/test/java/org/apache/commons/fileupload/utils/mime/MimeUtilityTestCase.java
new file mode 100644
index 0000000..56e1482
--- /dev/null
+++ b/src/test/java/org/apache/commons/fileupload/utils/mime/MimeUtilityTestCase.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.fileupload.utils.mime;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.commons.fileupload.util.mime.MimeUtility;
+import org.junit.Test;
+
+/**
+ * @since 1.3
+ */
+public final class MimeUtilityTestCase {
+
+    @Test
+    public void testEncodeText() throws Exception {
+        assertEncoded("abc", "abc");
+
+        assertEncoded(" hé! àèôu !!!", "=?UTF-8?Q?_h=C3=A9!_=C3=A0=C3=A8=C3=B4u_!!!?=");
+
+        assertEncoded(" hé! àèôu !!!", "=?UTF-8?B?IGjDqSEgw6DDqMO0dSAhISE=?=");
+    }
+
+    private static void assertEncoded(String expected, String encoded) throws Exception {
+        assertEquals(expected, MimeUtility.decodeText(encoded));
+    }
+
+}