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 17 package org.apache.harmony.tests.java.nio.charset; 18 19 import java.nio.charset.CoderMalfunctionError; 20 21 import junit.framework.TestCase; 22 23 import org.apache.harmony.testframework.serialization.SerializationTest; 24 25 /** 26 * Test java.nio.CoderMalfunctionError. 27 */ 28 public class CoderMalfunctionErrorTest extends TestCase { 29 30 /* 31 * Test constructor with normal param. 32 */ 33 public void testConstructor_Normal() { 34 Exception ex = new Exception(); 35 CoderMalfunctionError e = new CoderMalfunctionError(ex); 36 assertSame(ex, e.getCause()); 37 } 38 39 /* 40 * Test constructor with null param. 41 */ 42 public void testConstructor_Null() { 43 CoderMalfunctionError e = new CoderMalfunctionError(null); 44 assertNull(e.getCause()); 45 } 46 47 /** 48 * @tests serialization/deserialization compatibility. 49 */ 50 public void testSerializationSelf() throws Exception { 51 52 SerializationTest.verifySelf(new CoderMalfunctionError(null)); 53 } 54 55 /** 56 * @tests serialization/deserialization compatibility with RI. 57 */ 58 public void testSerializationCompatibility() throws Exception { 59 SerializationTest.verifyGolden(this, new CoderMalfunctionError(null)); 60 61 } 62 } 63