JmxUtil { public static ObjectName newObjectName(String pName) { try { return new ObjectName(pName); } catch (MalformedObjectNameException e) { throw new IllegalArgumentException("Invalid object name " + pName,e); } } private  JmxUtil(); static ObjectName newObjectName(String pName); static void addMBeanRegistrationListener(MBeanServerConnection pServer, NotificationListener pListener,
                                                    ObjectName pObjectNameToFilter); static void removeMBeanRegistrationListener(MBeanServerConnection pServer,NotificationListener pListener);  }
@Test public void newObjectName() throws MalformedObjectNameException { ObjectName name = JmxUtil.newObjectName("java.lang:type=blub"); assertEquals(name, new ObjectName("java.lang:type=blub")); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*Invalid.*sogehtsnicht.*") public void invalidObjectName() { JmxUtil.newObjectName("bla:blub:name=sogehtsnicht"); }