User: juhalindfors
Date: 02/04/10 16:17:25
Modified: src/main/test/compliance/server MBeanServerTEST.java
Log:
rest of the instantiate tests
Revision Changes Path
1.12 +95 -2 jmx/src/main/test/compliance/server/MBeanServerTEST.java
Index: MBeanServerTEST.java
===================================================================
RCS file: /cvsroot/jboss/jmx/src/main/test/compliance/server/MBeanServerTEST.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- MBeanServerTEST.java 8 Apr 2002 23:26:24 -0000 1.11
+++ MBeanServerTEST.java 10 Apr 2002 23:17:24 -0000 1.12
@@ -54,7 +54,7 @@
* Tests the MBean server impl. through the <tt>MBeanServer</tt> interface.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
- * @version $Revision: 1.11 $
+ * @version $Revision: 1.12 $
*
*/
public class MBeanServerTEST
@@ -891,6 +891,100 @@
assertTrue(e.getTargetException() instanceof ClassNotFoundException);
}
}
+
+ /**
+ * Tests instantiate(String className, Object[] args, String[] sign) with null
+ * class name. According to javadoc, should throw RuntimeOperationsException
+ * wrapping IllegalArgException.
+ */
+ public void testInstantiateWithNullClassName3() throws Exception
+ {
+ try
+ {
+ MBeanServer server = MBeanServerFactory.createMBeanServer();
+ Object o = server.instantiate(null, null, null);
+
+ // should not reach here
+ fail("incorrect exception behavior");
+ }
+ catch (RuntimeOperationsException e)
+ {
+ // expected
+
+ // check that it wraps IAE
+ assertTrue(e.getTargetException() instanceof IllegalArgumentException);
+ }
+ }
+
+ /**
+ * Tests instantiate(String className, Object[] args, String[] sign) with
+ * empty class name string. should throw ReflectionException wrapping CNFE.
+ */
+ public void testInstantiateWithEmptyClassName3() throws Exception
+ {
+ try
+ {
+ MBeanServer server = MBeanServerFactory.createMBeanServer();
+ Object o = server.instantiate("", null, null);
+
+ // should not reach here
+ fail("incorrect exception/classloading behavior");
+ }
+ catch (ReflectionException e)
+ {
+ // expected
+
+ // check that it wraps CNFE
+ assertTrue(e.getTargetException() instanceof ClassNotFoundException);
+ }
+ }
+
+ /**
+ * Tests instantiate(String className, ObjectName loader, Object[] args,
String[] sign)
+ * with null class name. According to javadoc, should throw
RuntimeOperationsException
+ * wrapping IllegalArgException.
+ */
+ public void testInstantiateWithNullClassName4() throws Exception
+ {
+ try
+ {
+ MBeanServer server = MBeanServerFactory.createMBeanServer();
+ Object o = server.instantiate(null, null, null, null);
+
+ // should not reach here
+ fail("incorrect exception behavior");
+ }
+ catch (RuntimeOperationsException e)
+ {
+ // expected
+
+ // check that it wraps IAE
+ assertTrue(e.getTargetException() instanceof IllegalArgumentException);
+ }
+ }
+
+ /**
+ * Tests instantiate(String className, ObjectName loader, Object[] args,
String[] sign)
+ * with empty class name string. should throw ReflectionException wrapping CNFE.
+ */
+ public void testInstantiateWithEmptyClassName4() throws Exception
+ {
+ try
+ {
+ MBeanServer server = MBeanServerFactory.createMBeanServer();
+ Object o = server.instantiate("", null, null, null);
+
+ // should not reach here
+ fail("incorrect exception/classloading behavior");
+ }
+ catch (ReflectionException e)
+ {
+ // expected
+
+ // check that it wraps CNFE
+ assertTrue(e.getTargetException() instanceof ClassNotFoundException);
+ }
+ }
/**
* Tests instantiate(String className) classloading behaviour. According to
@@ -952,7 +1046,6 @@
assertTrue(e.getTargetException() instanceof ClassNotFoundException);
}
}
-
// MBeanServer registerMBean ------------------------------------
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development