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