MBeanServer server = MBeanServerFactory.newMBeanServer();
ObjectName name = new ObjectName("test:foo=bar");
try
{
server.registerMBean(new Test4(), name);
// should not reach here
fail("Test4 registered despite of throwing an exception from the preRegister() method.");
}
catch (MBeanRegistrationException e)