1 package xdoclet.sdk.beans; 2 3 import junit.framework.TestCase; 4 5 import java.beans.BeanInfo; 6 import java.beans.Introspector; 7 import java.beans.MethodDescriptor; 8 import java.beans.ParameterDescriptor; 9 import java.lang.reflect.Method; 10 11 import xdoclet.XDoclet; 12 13 /*** 14 * 15 * @author <a href="mailto:aslak.hellesoy at bekk.no">Aslak Hellesøy</a> 16 * @version $Revision: 1.2 $ 17 */ 18 public class BeanInfoPluginTest extends TestCase { 19 public void setUp() { 20 } 21 22 public void tearDown() { 23 } 24 25 public void testGetBeanInfo() throws Exception { 26 Method createPlugin = XDoclet.class.getMethod("createPlugin", new Class[] {String.class}); 27 Method execute = XDoclet.class.getMethod("execute", null); 28 BeanInfo beanInfo = Introspector.getBeanInfo(XDoclet.class); 29 MethodDescriptor[] mds = beanInfo.getMethodDescriptors(); 30 assertTrue( mds.length > 3 ); 31 for (int i = 0; i < mds.length; i++) { 32 MethodDescriptor md = mds[i]; 33 if( md.getMethod().equals(createPlugin)) { 34 ParameterDescriptor[] pds = md.getParameterDescriptors(); 35 // See javadoc of @param pluginName 36 assertEquals("Plugin name", pds[0].getDisplayName()); 37 38 // All methods but the createPlugin method should be hidden 39 assertTrue(!md.isHidden()); 40 } else if(md.getMethod().equals(execute)) { 41 // Do nothing 42 } else { 43 // assertTrue("" + md.getMethod() + " should be hidden.", md.isHidden()); 44 } 45 } 46 } 47 }

This page was automatically generated by Maven