1 package test.tuigwaa;
2
3 import java.beans.PropertyDescriptor;
4
5 import junit.framework.TestCase;
6
7 import org.apache.commons.beanutils.PropertyUtils;
8
9 public class PluginTest extends TestCase{
10
11
12
13
14
15
16
17
18 public String getName(){
19 return getClass().getName();
20 }
21
22 public void testName(){
23 String packageName = getClass().getPackage().getName();
24 String className = getClass().getName();
25
26 System.out.println(className.substring(packageName.length() + 1, className.length() - "Test".length()));
27
28
29 }
30
31 public void testClass(){
32 TestBean bean = new TestBean();
33 PropertyDescriptor[] descs = PropertyUtils.getPropertyDescriptors(bean);
34 for(int i=0; i<descs.length; i++){
35 PropertyDescriptor desc = descs[i];
36 System.out.println(desc.getName() + "-" + desc.getPropertyType());
37
38
39 }
40 }
41
42 class TestBean{
43
44 boolean b1;
45
46 Boolean b2;
47
48 public boolean isB1() {
49 return b1;
50 }
51
52 public void setB1(boolean b1) {
53 this.b1 = b1;
54 }
55
56 public Boolean getB2() {
57 return b2;
58 }
59
60 public void setB2(Boolean b2) {
61 this.b2 = b2;
62 }
63
64
65
66 }
67
68 }
69