1561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes/* Licensed to the Apache Software Foundation (ASF) under one or more 2561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * contributor license agreements. See the NOTICE file distributed with 3561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * this work for additional information regarding copyright ownership. 4561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * The ASF licenses this file to You under the Apache License, Version 2.0 5561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * (the "License"); you may not use this file except in compliance with 6561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * the License. You may obtain a copy of the License at 7561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * 8561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 9561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * 10561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * Unless required by applicable law or agreed to in writing, software 11561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 12561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * See the License for the specific language governing permissions and 14561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * limitations under the License. 15561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes */ 16561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughespackage org.apache.harmony.luni.tests.java.util; 17561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 18561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.io.Serializable; 19561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.util.InputMismatchException; 20561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.util.NoSuchElementException; 21561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 22561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport junit.framework.TestCase; 23561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 24561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport org.apache.harmony.testframework.serialization.SerializationTest; 25561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 26561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughespublic class InputMismatchExceptionTest extends TestCase { 27561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 28561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes private static final String ERROR_MESSAGE = "for serialization test"; //$NON-NLS-1$ 29561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 30561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes /** 31561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * @tests java.util.InputMismatchException#InputMismatchException() 32561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes */ 33561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes @SuppressWarnings("cast") 34561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public void test_Constructor() { 35561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes InputMismatchException exception = new InputMismatchException(); 36561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes assertNotNull(exception); 37561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes assertTrue(exception instanceof NoSuchElementException); 38561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes assertTrue(exception instanceof Serializable); 39561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 40561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 41561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes /** 42561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * @tests java.util.InputMismatchException#InputMismatchException(String) 43561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes */ 44561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public void test_ConstructorLjava_lang_String() { 45561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes InputMismatchException exception = new InputMismatchException( 46561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes ERROR_MESSAGE); 47561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes assertNotNull(exception); 48561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes assertEquals(ERROR_MESSAGE, exception.getMessage()); 49561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 50561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 51561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes /** 52561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * @tests serialization/deserialization. 53561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes */ 54561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public void testSerializationSelf() throws Exception { 55561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 56561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes SerializationTest.verifySelf(new InputMismatchException(ERROR_MESSAGE)); 57561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 58561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 59561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes /** 60561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * @tests serialization/deserialization compatibility with RI. 61561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes */ 62561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public void testSerializationCompatibility() throws Exception { 63561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 64561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes SerializationTest.verifyGolden(this, new InputMismatchException( 65561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes ERROR_MESSAGE)); 66561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 67561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes} 68