1d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes/* 2d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * Licensed to the Apache Software Foundation (ASF) under one or more 3d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * contributor license agreements. See the NOTICE file distributed with 4d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * this work for additional information regarding copyright ownership. 5d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * The ASF licenses this file to You under the Apache License, Version 2.0 6d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * (the "License"); you may not use this file except in compliance with 7d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * the License. You may obtain a copy of the License at 8d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * 9d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 10d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * 11d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * Unless required by applicable law or agreed to in writing, software 12d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 13d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * See the License for the specific language governing permissions and 15d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * limitations under the License. 16d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes */ 17d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes 18d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughespackage org.apache.harmony.annotation.tests.java.lang.annotation; 19d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes 20d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughesimport java.lang.annotation.AnnotationTypeMismatchException; 21d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughesimport java.lang.reflect.Method; 22d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes 23d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughesimport junit.framework.TestCase; 24d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes 25d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes/** 26d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * Test case of java.lang.annotation.AnnotationTypeMismatchException 27d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes */ 28d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughespublic class AnnotationTypeMismatchExceptionTest extends TestCase { 29d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes 30d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes /** 31d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * @throws ClassNotFoundException 32d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * @throws SecurityException 33d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * @tests java.lang.annotation.AnnotationTypeMismatchException#AnnotationTypeMismatchException(Method, 34d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes * String) 35d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes */ 36d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes @SuppressWarnings("nls") 37d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes public void test_constructorLjava_lang_reflect_MethodLjava_lang_String() throws SecurityException, ClassNotFoundException { 38d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes Method[] methods = Class.forName("java.lang.String").getMethods(); 39d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes Method m = methods[0]; 40d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes AnnotationTypeMismatchException e = new AnnotationTypeMismatchException( 41d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes m, "some type"); 42d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes assertNotNull("can not instantiate AnnotationTypeMismatchException", e); 43d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes assertSame("wrong method name", m, e.element()); 44d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes assertEquals("wrong found type", "some type", e.foundType()); 45d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes } 46d0d215d5a6cf237f829908b3921a630bbe46f0e4Elliott Hughes} 47