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