01: /* Licensed to the Apache Software Foundation (ASF) under one or more
02: * contributor license agreements. See the NOTICE file distributed with
03: * this work for additional information regarding copyright ownership.
04: * The ASF licenses this file to You under the Apache License, Version 2.0
05: * (the "License"); you may not use this file except in compliance with
06: * the License. You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package org.apache.harmony.nio.tests.java.nio;
17:
18: import java.nio.ByteBuffer;
19: import java.nio.ByteOrder;
20:
21: public class DirectCharBufferTest extends CharBufferTest {
22:
23: public void setUp() {
24: buf = ByteBuffer.allocateDirect(BUFFER_LENGTH * 2)
25: .asCharBuffer();
26: super .loadTestData1(buf);
27: baseBuf = buf;
28: }
29:
30: public void tearDown() {
31: buf = null;
32: baseBuf = null;
33: }
34:
35: public void testHasArray() {
36: assertFalse(buf.hasArray());
37: }
38:
39: public void testArray() {
40: try {
41: buf.array();
42: fail("Should throw UnsupportedOperationException"); //$NON-NLS-1$
43: } catch (UnsupportedOperationException e) {
44: }
45: }
46:
47: public void testArrayOffset() {
48: try {
49: buf.arrayOffset();
50: fail("Should throw UnsupportedOperationException"); //$NON-NLS-1$
51: } catch (UnsupportedOperationException e) {
52: }
53: }
54:
55: public void testIsDirect() {
56: assertTrue(buf.isDirect());
57: }
58:
59: public void testOrder() {
60: assertEquals(ByteOrder.BIG_ENDIAN, buf.order());
61: }
62: }
|