@@ -0,0 +1,1091 @@
+import static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assume.assumeTrue;%0A%0Aimport java.nio.charset.Charset;%0A%0Aimport org.jcodings.Encoding;%0Aimport org.jcodings.EncodingDB;%0Aimport org.jcodings.EncodingDB.Entry;%0Aimport org.jcodings.specific.GBKEncoding;%0Aimport org.jcodings.util.CaseInsensitiveBytesHash;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Apublic class TestGBK %7B%0A%0A%09private CaseInsensitiveBytesHash%3CEntry%3E encodings;%0A%0A%09@Before%0A%09public void setUp() throws Exception %7B%0A%09%09encodings = EncodingDB.getEncodings();%0A%09%7D%0A%0A%09@Test%0A%09public void testGBK() %7B%0A%09%09String charset_name = Charset.defaultCharset().displayName();%0A%0A%09%09assumeTrue(charset_name.equals(%22GBK%22));%0A%0A%09%09Encoding from_jcodings = encodings.get(charset_name.getBytes()).getEncoding();%0A%09%09assertEquals(%22the encoding got from jcodings should also be GBK, same as input%22, charset_name, from_jcodings.toString());%0A%09%7D%0A%0A%09@Test%0A%09public void testGBKEncoding() %7B%0A%09%09assertEquals(%22GBKEncoding.INSTANCE should be of type GBKEncoding%22, GBKEncoding.class.getCanonicalName(), GBKEncoding.INSTANCE.getClass().getCanonicalName());%0A%09%7D%0A%7D%0A%0A

add testcase for gbk bug (caused JRUBY-6267)