1 19 20 package org.openide.nodes; 21 22 import java.beans.BeanDescriptor ; 23 import java.beans.BeanInfo ; 24 import java.beans.Introspector ; 25 import org.netbeans.junit.NbTestCase; 26 import org.openide.util.HelpCtx; 27 28 36 public class BeanNodeBug21341 extends NbTestCase { 37 38 39 40 public BeanNodeBug21341(String s) { 41 super(s); 42 } 43 44 public static void main(String [] args)throws Exception { 45 46 47 BeanInfo bi = Introspector.getBeanInfo( Bean21341Hidden.class ); 48 BeanDescriptor bd = bi.getBeanDescriptor(); 49 50 System.out.println(" shortDescription : " + bd.getShortDescription() ); 51 System.out.println(" helpID : " + bd.getValue( "HelpID" ) ); 52 } 54 55 56 57 public void testHelpID() throws Exception { 58 59 BeanNode bn = new BeanNode( new Bean21341Hidden() ); 60 HelpCtx hCtx = bn.getHelpCtx(); 61 62 64 assertTrue( "HelpID".equals( hCtx.getHelpID() ) ); 65 } 66 67 public void testPropertiesHelpID() throws Exception { 68 69 BeanNode bn = new BeanNode( new Bean21341Hidden() ); 70 Node.PropertySet[] ps = bn.getPropertySets(); 71 Node.PropertySet propertySet = null; 72 73 for( int i = 0; i < ps.length; i++ ) { 74 if ( Sheet.PROPERTIES.equals( ps[i].getName() ) ) { 75 propertySet = ps[i]; 76 break; 77 } 78 } 79 80 82 if ( propertySet == null ) { 83 fail( "Property set not found" ); 84 } 85 else { 86 assertTrue( "PropertiesHelpID".equals( propertySet.getValue( "helpID" ) ) ); 87 } 88 } 89 90 public void testExpertHelpID() throws Exception { 91 92 BeanNode bn = new BeanNode( new Bean21341Hidden() ); 93 Node.PropertySet[] ps = bn.getPropertySets(); 94 Node.PropertySet propertySet = null; 95 96 for( int i = 0; i < ps.length; i++ ) { 97 if ( Sheet.EXPERT.equals( ps[i].getName() ) ) { 98 propertySet = ps[i]; 99 break; 100 } 101 } 102 103 105 if ( propertySet == null ) { 106 fail( "Property set not found" ); 107 } 108 else { 109 assertTrue( "ExpertHelpID".equals( propertySet.getValue( "helpID" ) ) ); 110 } 111 } 112 113 } 114 | Popular Tags |