summaryrefslogtreecommitdiff
path: root/test/java.beans/IntrospectorTest.java
blob: d0ddfd9debd834f004ba98008ad8aa258e6f05c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import java.beans.*;

public class IntrospectorTest {
	public static void main(String[] args) {
		try {
			BeanInfo b = Introspector.getBeanInfo(java.awt.Component.class);
			if(b.getPropertyDescriptors().length == 6
			   && b.getEventSetDescriptors().length == 5
			   && b.getMethodDescriptors().length == 128) {
				System.out.println("PASSED: Introspector.getBeanInfo(java.awt.Component.class)");
			} else {
				System.out.println("FAILED: Introspector.getBeanInfo(java.awt.Component.class)");
			}
			b = Introspector.getBeanInfo(java.util.BitSet.class);
			if(b.getPropertyDescriptors().length == 2
			   && b.getEventSetDescriptors().length == 0
			   && b.getMethodDescriptors().length == 17) {
				System.out.println("PASSED: Introspector.getBeanInfo(java.util.BitSet.class)");
			} else {
				System.out.println("FAILED: Introspector.getBeanInfo(java.util.BitSet.class)");
			}
			b = Introspector.getBeanInfo(java.lang.Object.class);
			if(b.getPropertyDescriptors().length == 1
			   && b.getEventSetDescriptors().length == 0
			   && b.getMethodDescriptors().length == 9) {
				System.out.println("PASSED: Introspector.getBeanInfo(java.lang.Object.class)");
			} else {
				System.out.println("FAILED: Introspector.getBeanInfo(java.lang.Object.class)");
			}
			b = Introspector.getBeanInfo(java.applet.Applet.class);
			if(b.getPropertyDescriptors().length == 24
			   && b.getEventSetDescriptors().length == 6
			   && b.getMethodDescriptors().length == 168) {
				System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class)");
			} else {
				System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class)");
			}
			b = Introspector.getBeanInfo(java.awt.Button.class);
			if(b.getPropertyDescriptors().length == 8
			   && b.getEventSetDescriptors().length == 6
			   && b.getMethodDescriptors().length == 134) {
				System.out.println("PASSED: Introspector.getBeanInfo(java.awt.Button.class)");
			} else {
				System.out.println("FAILED: Introspector.getBeanInfo(java.awt.Button.class)");
			}
			b = Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Panel.class);
			if(b.getPropertyDescriptors().length == 8
			   && b.getEventSetDescriptors().length == 0
			   && b.getMethodDescriptors().length == 22) {
				System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Panel.class)");
			} else {
				System.out.println(b.getPropertyDescriptors().length + " " + b.getEventSetDescriptors().length + " " + b.getMethodDescriptors().length);
				System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Panel.class)");
			}
			b = Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Component.class);
			if(b.getPropertyDescriptors().length == 18
			   && b.getEventSetDescriptors().length == 1
			   && b.getMethodDescriptors().length == 65) {
				System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Component.class)");
			} else {
				System.out.println(b.getPropertyDescriptors().length + " " + b.getEventSetDescriptors().length + " " + b.getMethodDescriptors().length);
				System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Component.class)");
			}
			b = Introspector.getBeanInfo(java.applet.Applet.class,java.lang.Object.class);
			if(b.getPropertyDescriptors().length == 24
			   && b.getEventSetDescriptors().length == 6
			   && b.getMethodDescriptors().length == 160) {
				System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class,java.lang.Object.class)");
			} else {
				System.out.println(b.getPropertyDescriptors().length + " " + b.getEventSetDescriptors().length + " " + b.getMethodDescriptors().length);
				System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class,java.lang.Object.class)");
			}

			b = Introspector.getBeanInfo(java.applet.Applet.class,null);
			if(b.getPropertyDescriptors().length == 24
			   && b.getEventSetDescriptors().length == 6
			   && b.getMethodDescriptors().length == 168) {
				System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class,java.lang.Object.class)");
			} else {
				System.out.println(b.getPropertyDescriptors().length + " " + b.getEventSetDescriptors().length + " " + b.getMethodDescriptors().length);
				System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class,null)");
			}

			b = Introspector.getBeanInfo(java.applet.Applet.class);
			if(b.getPropertyDescriptors().length == 24
			   && b.getEventSetDescriptors().length == 6
			   && b.getMethodDescriptors().length == 168) {
				System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class) 2nd time");
			} else {
				System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class) 2nd time");
			}
		} catch(IntrospectionException e) {
			System.out.println("FAILED: IntrospectionException");
			e.printStackTrace();
		}
	}
}