You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2017/06/09 09:39:25 UTC

[2/6] [lang] Make sure deprecated CharEncoding constants are equal to the values defined in StandardCharsets

Make sure deprecated CharEncoding constants are equal to the values defined in StandardCharsets


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/5ffb6620
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/5ffb6620
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/5ffb6620

Branch: refs/heads/release
Commit: 5ffb662019501692112fbebf15d92d01c17f1322
Parents: 18e6924
Author: Benedikt Ritter <br...@apache.org>
Authored: Fri Jun 9 11:37:19 2017 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Fri Jun 9 11:37:19 2017 +0200

----------------------------------------------------------------------
 .../org/apache/commons/lang3/CharEncodingTest.java     | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/5ffb6620/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharEncodingTest.java b/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
index 7999457..5f7748c 100644
--- a/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
@@ -17,11 +17,14 @@
 
 package org.apache.commons.lang3;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
 
+import java.nio.charset.StandardCharsets;
+
 /**
  * Tests CharEncoding.
  *
@@ -68,4 +71,14 @@ public class CharEncodingTest  {
         assertFalse(CharEncoding.isSupported("DOESNOTEXIST"));
         assertFalse(CharEncoding.isSupported("this is not a valid encoding name"));
     }
+
+    @Test
+    public void testStandardCharsetsEquality() throws Exception {
+        assertEquals(StandardCharsets.ISO_8859_1.name(), CharEncoding.ISO_8859_1);
+        assertEquals(StandardCharsets.US_ASCII.name(), CharEncoding.US_ASCII);
+        assertEquals(StandardCharsets.UTF_8.name(), CharEncoding.UTF_8);
+        assertEquals(StandardCharsets.UTF_16.name(), CharEncoding.UTF_16);
+        assertEquals(StandardCharsets.UTF_16BE.name(), CharEncoding.UTF_16BE);
+        assertEquals(StandardCharsets.UTF_16LE.name(), CharEncoding.UTF_16LE);
+    }
 }