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 org.apache.harmony.nio.tests.java.nio;
18
19import dalvik.annotation.TestTargets;
20import dalvik.annotation.TestLevel;
21import dalvik.annotation.TestTargetNew;
22import dalvik.annotation.TestTargetClass;
23
24import java.nio.BufferOverflowException;
25
26import junit.framework.TestCase;
27
28import org.apache.harmony.testframework.serialization.SerializationTest;
29
30@TestTargetClass(BufferOverflowException.class)
31public class BufferOverflowExceptionTest extends TestCase {
32
33    /**
34     * @tests serialization/deserialization compatibility.
35     */
36    @TestTargets({
37        @TestTargetNew(
38            level = TestLevel.COMPLETE,
39            notes = "Verifies serialization/deserialization compatibility. And tests default constructor",
40            method = "!SerializationSelf",
41            args = {}
42        ),
43        @TestTargetNew(
44            level = TestLevel.PARTIAL_COMPLETE,
45            notes = "",
46            method = "BufferOverflowException",
47            args = {}
48        )
49    })
50    public void testSerializationSelf() throws Exception {
51
52        SerializationTest.verifySelf(new BufferOverflowException());
53    }
54
55    /**
56     * @tests serialization/deserialization compatibility with RI.
57     */
58    @TestTargets({
59        @TestTargetNew(
60            level = TestLevel.COMPLETE,
61            notes = "Verifies serialization/deserialization compatibility.",
62            method = "!SerializationGolden",
63            args = {}
64        ),
65        @TestTargetNew(
66            level = TestLevel.PARTIAL_COMPLETE,
67            notes = "",
68            method = "BufferOverflowException",
69            args = {}
70        )
71    })
72    public void testSerializationCompatibility() throws Exception {
73
74        SerializationTest.verifyGolden(this, new BufferOverflowException());
75    }
76
77    /**
78     *@tests {@link java.nio.BufferOverflowException#BufferOverflowException()}
79     */
80    @TestTargetNew(
81        level = TestLevel.PARTIAL_COMPLETE,
82        notes = "",
83        method = "BufferOverflowException",
84        args = {}
85    )
86    public void test_Constructor() {
87        BufferOverflowException exception = new BufferOverflowException();
88        assertNull(exception.getMessage());
89        assertNull(exception.getLocalizedMessage());
90        assertNull(exception.getCause());
91    }
92}
93