You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2012/03/20 02:32:37 UTC

svn commit: r1302747 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/ByteOrderMarkTestCase.java

Author: ggregory
Date: Tue Mar 20 01:32:37 2012
New Revision: 1302747

URL: http://svn.apache.org/viewvc?rev=1302747&view=rev
Log:
Tests that {@link ByteOrderMark#getCharsetName()} can be loaded as a {@link java.nio.charset.Charset} as advertised.

Modified:
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/ByteOrderMarkTestCase.java

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/ByteOrderMarkTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/ByteOrderMarkTestCase.java?rev=1302747&r1=1302746&r2=1302747&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/ByteOrderMarkTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/ByteOrderMarkTestCase.java Tue Mar 20 01:32:37 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.io;
 
+import java.nio.charset.Charset;
 import java.util.Arrays;
 
 import org.apache.commons.io.testtools.FileBasedTestCase;
@@ -43,6 +44,13 @@ public class ByteOrderMarkTestCase exten
         assertEquals("test3 name", "test3", TEST_BOM_3.getCharsetName());
     }
 
+    /** Tests that {@link ByteOrderMark#getCharsetName()} can be loaded as a {@link java.nio.charset.Charset} as advertised. */
+    public void testConstantCharsetNames() {
+        assertNotNull(Charset.forName(ByteOrderMark.UTF_16BE.getCharsetName()));
+        assertNotNull(Charset.forName(ByteOrderMark.UTF_16LE.getCharsetName()));
+        assertNotNull(Charset.forName(ByteOrderMark.UTF_8.getCharsetName()));
+    }
+
     /** Test {@link ByteOrderMark#length()} */
     public void testLength() {
         assertEquals("test1 length", 1, TEST_BOM_1.length());