summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Keiser <shalom@gnu.org>1998-08-02 23:52:22 +0000
committerJohn Keiser <shalom@gnu.org>1998-08-02 23:52:22 +0000
commit8408b04466376dba001a60926e4b8b9b67939863 (patch)
tree7e1d80052c5881547ccfcbdb55aafee7ad60038f /test
parentcad44999dea6712aac06c58ae4c1f12934b2288f (diff)
downloadclasspath-8408b04466376dba001a60926e4b8b9b67939863.tar.gz
Started a real test suite for java.beans.
Diffstat (limited to 'test')
-rw-r--r--test/java.beans/DescriptorTest.java37
-rw-r--r--test/java.beans/IntrospectorTest.java97
2 files changed, 134 insertions, 0 deletions
diff --git a/test/java.beans/DescriptorTest.java b/test/java.beans/DescriptorTest.java
new file mode 100644
index 000000000..b2e18d5b3
--- /dev/null
+++ b/test/java.beans/DescriptorTest.java
@@ -0,0 +1,37 @@
+import java.beans.*;
+
+public class DescriptorTest {
+ public static void main(String[] args) {
+ try {
+ new PropertyDescriptor("class",java.lang.Object.class);
+ System.out.println("PASSED: Property Object.class");
+ } catch(IntrospectionException e) {
+ System.out.println("FAILED: Property Object.class");
+ e.printStackTrace();
+ }
+
+ try {
+ new IndexedPropertyDescriptor("test",TestClass.class);
+ System.out.println("PASSED: Indexed Property Component.location");
+ } catch(IntrospectionException e) {
+ System.out.println("FAILED: Indexed Property Component.location");
+ e.printStackTrace();
+ }
+
+ try {
+ new EventSetDescriptor(java.awt.Button.class,"action",java.awt.event.ActionListener.class,"actionPerformed");
+ System.out.println("PASSED: Event Set Button.action");
+ } catch(IntrospectionException e) {
+ System.out.println("FAILED: Event Set Button.action");
+ e.printStackTrace();
+ }
+
+ try {
+ new MethodDescriptor(java.awt.Component.class.getMethod("getLocation",new Class[0]));
+ System.out.println("PASSED: Method Component.getLocation");
+ } catch(NoSuchMethodException e) {
+ System.out.println("FAILED: No such method: Component.getLocation()");
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/test/java.beans/IntrospectorTest.java b/test/java.beans/IntrospectorTest.java
new file mode 100644
index 000000000..d0ddfd9de
--- /dev/null
+++ b/test/java.beans/IntrospectorTest.java
@@ -0,0 +1,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();
+ }
+ }
+}