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 * TODO typedef
25 */
26public class UTF16LECharsetDecoderTest extends CharsetDecoderTest {
27
28    protected void setUp() throws Exception {
29        cs = Charset.forName("utf-16le");
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.5, 0.001);
45    // assertEquals(decoder.maxCharsPerByte(), 2, 0.001);
46    // }
47
48    ByteBuffer getUnmappedByteBuffer() throws UnsupportedEncodingException {
49        // no unmap byte buffer
50        return null;
51    }
52
53    ByteBuffer getMalformedByteBuffer() throws UnsupportedEncodingException {
54        // FIXME: different here, JDK can parse 0xd8d8
55        // ByteBuffer buffer = ByteBuffer.allocate(100);
56        // buffer.put((byte)0xd8);
57        // buffer.put((byte)0xd8);
58        // buffer.put(unibytes);
59        // buffer.flip();
60        // return buffer;
61        return null;
62    }
63
64    ByteBuffer getExceptionByteArray() throws UnsupportedEncodingException {
65        return null;
66    }
67
68    protected ByteBuffer getByteBuffer() {
69        return ByteBuffer.wrap(new byte[] { 32, 0, 98, 0, 117, 0, 102, 0, 102,
70                0, 101, 0, 114, 0 });
71    }
72}
73