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