Path: blob/master/test/jdk/java/beans/Introspector/6976577/Test6976577.java
41153 views
/*1* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 697657726* @summary Tests public methods in non-public beans27* @author Sergey Malenkov28*/2930import test.Accessor;3132import java.beans.EventSetDescriptor;33import java.beans.IndexedPropertyDescriptor;34import java.beans.PropertyDescriptor;35import java.lang.reflect.Method;3637public class Test6976577 {3839public static void main(String[] args) throws Exception {40Class<?> bt = Accessor.getBeanType();41Class<?> lt = Accessor.getListenerType();4243// test PropertyDescriptor44PropertyDescriptor pd = new PropertyDescriptor("boolean", bt);45test(pd.getReadMethod());46test(pd.getWriteMethod());4748// test IndexedPropertyDescriptor49IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed", bt);50test(ipd.getReadMethod());51test(ipd.getWriteMethod());52test(ipd.getIndexedReadMethod());53test(ipd.getIndexedWriteMethod());5455// test EventSetDescriptor56EventSetDescriptor esd = new EventSetDescriptor(bt, "test", lt, "process");57test(esd.getAddListenerMethod());58test(esd.getRemoveListenerMethod());59test(esd.getGetListenerMethod());60test(esd.getListenerMethods());61}6263private static void test(Method... methods) {64for (Method method : methods) {65if (method == null) {66throw new Error("public method is not found");67}68}69}70}717273