1 18 package net.sf.uitags.tagutil; 19 20 import java.beans.PropertyDescriptor ; 21 22 import net.sf.uitags.tagutil.bean.TagBeanInfo; 23 24 import junit.framework.TestCase; 25 26 32 public final class TagBeanInfoTest extends TestCase { 33 36 private JavaBeanClassBeanInfo info; 37 38 43 public static void main(String [] args) { 44 junit.textui.TestRunner.run(TagBeanInfoTest.class); 45 } 46 47 48 protected void setUp() throws Exception { 49 super.setUp(); 50 this.info = new JavaBeanClassBeanInfo(); 51 } 52 53 54 protected void tearDown() throws Exception { 55 super.tearDown(); 56 this.info = null; 57 } 58 59 60 61 65 69 public void testGetPropertyDescriptors() { 70 PropertyDescriptor [] props = this.info.getPropertyDescriptors(); 71 72 assertTrue(props.length == 2); 73 74 for (int i = 0; i < props.length; i++) { 75 assertTrue( 76 props[i].getName().equals("firstProp") || 77 props[i].getName().equals("secondProp")); 78 } 79 } 80 81 82 86 89 public static class JavaBeanClass { 90 String s; 91 Long l; 92 93 public String getFirstProp() { return ""; } 94 public void setFirstProp(String s) { 95 this.s = s; 96 } 97 98 public Long getSecondProp() { return null; } 99 public void setSecondProp(Long l) { 100 this.l = l; 101 } 102 103 public String getThirdProp() { return ""; } 104 } 105 106 110 private static class JavaBeanClassBeanInfo extends TagBeanInfo { 111 } 113 } 114 | Popular Tags |