1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements.  See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License.  You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package tests.api.java.nio.charset;
18
19import java.io.UnsupportedEncodingException;
20import java.nio.ByteBuffer;
21import java.nio.charset.Charset;
22
23/**
24 * test gb18030 decoder
25 */
26public class GBCharsetDecoderTest extends CharsetDecoderTest {
27
28	protected void setUp() throws Exception {
29		cs = Charset.forName("gb18030");
30		super.setUp();
31	}
32
33	/*
34	 * @see CharsetDecoderTest#tearDown()
35	 */
36	protected void tearDown() throws Exception {
37		super.tearDown();
38	}
39
40	// // FIXME: give up this tests
41	// public void testDefaultCharsPerByte(){
42	// //assertEquals(1, decoder.averageCharsPerByte());
43	// //assertEquals(1, decoder.maxCharsPerByte());
44	// assertEquals(decoder.averageCharsPerByte(), 0.25, 0.001);
45	// assertEquals(decoder.maxCharsPerByte(), 2, 0.001);
46	// }
47
48	ByteBuffer getUnmappedByteBuffer() throws UnsupportedEncodingException {
49		return null;
50	}
51
52	ByteBuffer getMalformedByteBuffer() throws UnsupportedEncodingException {
53		ByteBuffer buffer = ByteBuffer.allocate(20);
54		buffer.put(new byte[] { (byte) 0xd8 });
55		buffer.put(getByteBuffer());
56		buffer.flip();
57		return buffer;
58	}
59
60	ByteBuffer getExceptionByteArray() throws UnsupportedEncodingException {
61		return null;
62	}
63
64}
65