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

This commit is contained in:
Benedikt Ritter 2017-06-09 11:37:19 +02:00
parent 18e692478d
commit 5ffb662019
No known key found for this signature in database
GPG Key ID: 9DAADC1C9FCC82D0
1 changed files with 13 additions and 0 deletions

View File

@ -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);
}
}