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 */
16package org.apache.harmony.nio.tests.java.nio.channels;
17
18import java.nio.channels.ClosedChannelException;
19
20import junit.framework.TestCase;
21
22import org.apache.harmony.testframework.serialization.SerializationTest;
23
24/**
25 * Tests for ClosedChannelException
26 */
27public class ClosedChannelExceptionTest extends TestCase {
28
29    /**
30     * @tests {@link java.nio.channels.ClosedChannelException#ClosedChannelException()}
31     */
32    public void test_Constructor() {
33        ClosedChannelException e = new ClosedChannelException();
34        assertNull(e.getMessage());
35        assertNull(e.getLocalizedMessage());
36        assertNull(e.getCause());
37    }
38
39    /**
40     * @tests serialization/deserialization compatibility.
41     */
42    public void testSerializationSelf() throws Exception {
43
44        SerializationTest.verifySelf(new ClosedChannelException());
45    }
46
47    /**
48     * @tests serialization/deserialization compatibility with RI.
49     */
50    public void testSerializationCompatibility() throws Exception {
51
52        SerializationTest.verifyGolden(this, new ClosedChannelException());
53    }
54}
55