1 |
14 |
jlechner |
import java.beans.*;
|
2 |
|
|
|
3 |
|
|
public class IntrospectorTest {
|
4 |
|
|
public static void main(String[] args) {
|
5 |
|
|
try {
|
6 |
|
|
BeanInfo b = Introspector.getBeanInfo(java.awt.Component.class);
|
7 |
|
|
if(b.getPropertyDescriptors().length == 6
|
8 |
|
|
&& b.getEventSetDescriptors().length == 5
|
9 |
|
|
&& b.getMethodDescriptors().length == 128) {
|
10 |
|
|
System.out.println("PASSED: Introspector.getBeanInfo(java.awt.Component.class)");
|
11 |
|
|
} else {
|
12 |
|
|
System.out.println("FAILED: Introspector.getBeanInfo(java.awt.Component.class)");
|
13 |
|
|
}
|
14 |
|
|
b = Introspector.getBeanInfo(java.util.BitSet.class);
|
15 |
|
|
if(b.getPropertyDescriptors().length == 2
|
16 |
|
|
&& b.getEventSetDescriptors().length == 0
|
17 |
|
|
&& b.getMethodDescriptors().length == 17) {
|
18 |
|
|
System.out.println("PASSED: Introspector.getBeanInfo(java.util.BitSet.class)");
|
19 |
|
|
} else {
|
20 |
|
|
System.out.println("FAILED: Introspector.getBeanInfo(java.util.BitSet.class)");
|
21 |
|
|
}
|
22 |
|
|
b = Introspector.getBeanInfo(java.lang.Object.class);
|
23 |
|
|
if(b.getPropertyDescriptors().length == 1
|
24 |
|
|
&& b.getEventSetDescriptors().length == 0
|
25 |
|
|
&& b.getMethodDescriptors().length == 9) {
|
26 |
|
|
System.out.println("PASSED: Introspector.getBeanInfo(java.lang.Object.class)");
|
27 |
|
|
} else {
|
28 |
|
|
System.out.println("FAILED: Introspector.getBeanInfo(java.lang.Object.class)");
|
29 |
|
|
}
|
30 |
|
|
b = Introspector.getBeanInfo(java.applet.Applet.class);
|
31 |
|
|
if(b.getPropertyDescriptors().length == 24
|
32 |
|
|
&& b.getEventSetDescriptors().length == 6
|
33 |
|
|
&& b.getMethodDescriptors().length == 168) {
|
34 |
|
|
System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class)");
|
35 |
|
|
} else {
|
36 |
|
|
System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class)");
|
37 |
|
|
}
|
38 |
|
|
b = Introspector.getBeanInfo(java.awt.Button.class);
|
39 |
|
|
if(b.getPropertyDescriptors().length == 8
|
40 |
|
|
&& b.getEventSetDescriptors().length == 6
|
41 |
|
|
&& b.getMethodDescriptors().length == 134) {
|
42 |
|
|
System.out.println("PASSED: Introspector.getBeanInfo(java.awt.Button.class)");
|
43 |
|
|
} else {
|
44 |
|
|
System.out.println("FAILED: Introspector.getBeanInfo(java.awt.Button.class)");
|
45 |
|
|
}
|
46 |
|
|
b = Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Panel.class);
|
47 |
|
|
if(b.getPropertyDescriptors().length == 8
|
48 |
|
|
&& b.getEventSetDescriptors().length == 0
|
49 |
|
|
&& b.getMethodDescriptors().length == 22) {
|
50 |
|
|
System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Panel.class)");
|
51 |
|
|
} else {
|
52 |
|
|
System.out.println(b.getPropertyDescriptors().length + " " + b.getEventSetDescriptors().length + " " + b.getMethodDescriptors().length);
|
53 |
|
|
System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Panel.class)");
|
54 |
|
|
}
|
55 |
|
|
b = Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Component.class);
|
56 |
|
|
if(b.getPropertyDescriptors().length == 18
|
57 |
|
|
&& b.getEventSetDescriptors().length == 1
|
58 |
|
|
&& b.getMethodDescriptors().length == 65) {
|
59 |
|
|
System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Component.class)");
|
60 |
|
|
} else {
|
61 |
|
|
System.out.println(b.getPropertyDescriptors().length + " " + b.getEventSetDescriptors().length + " " + b.getMethodDescriptors().length);
|
62 |
|
|
System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Component.class)");
|
63 |
|
|
}
|
64 |
|
|
b = Introspector.getBeanInfo(java.applet.Applet.class,java.lang.Object.class);
|
65 |
|
|
if(b.getPropertyDescriptors().length == 24
|
66 |
|
|
&& b.getEventSetDescriptors().length == 6
|
67 |
|
|
&& b.getMethodDescriptors().length == 160) {
|
68 |
|
|
System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class,java.lang.Object.class)");
|
69 |
|
|
} else {
|
70 |
|
|
System.out.println(b.getPropertyDescriptors().length + " " + b.getEventSetDescriptors().length + " " + b.getMethodDescriptors().length);
|
71 |
|
|
System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class,java.lang.Object.class)");
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
b = Introspector.getBeanInfo(java.applet.Applet.class,null);
|
75 |
|
|
if(b.getPropertyDescriptors().length == 24
|
76 |
|
|
&& b.getEventSetDescriptors().length == 6
|
77 |
|
|
&& b.getMethodDescriptors().length == 168) {
|
78 |
|
|
System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class,java.lang.Object.class)");
|
79 |
|
|
} else {
|
80 |
|
|
System.out.println(b.getPropertyDescriptors().length + " " + b.getEventSetDescriptors().length + " " + b.getMethodDescriptors().length);
|
81 |
|
|
System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class,null)");
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
b = Introspector.getBeanInfo(java.applet.Applet.class);
|
85 |
|
|
if(b.getPropertyDescriptors().length == 24
|
86 |
|
|
&& b.getEventSetDescriptors().length == 6
|
87 |
|
|
&& b.getMethodDescriptors().length == 168) {
|
88 |
|
|
System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class) 2nd time");
|
89 |
|
|
} else {
|
90 |
|
|
System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class) 2nd time");
|
91 |
|
|
}
|
92 |
|
|
} catch(IntrospectionException e) {
|
93 |
|
|
System.out.println("FAILED: IntrospectionException");
|
94 |
|
|
e.printStackTrace();
|
95 |
|
|
}
|
96 |
|
|
}
|
97 |
|
|
}
|