static public ObjectName register(String serviceName, String nameName,
                                    Object theMbean) {
    return register(serviceName, nameName, Collections.emptyMap(), theMbean);
  }
@Test
  public void testRegister() throws Exception {
    ObjectName objectName = null;
    try {
      counter = 23;
      objectName = MBeans.register("UnitTest",
          "RegisterTest", this);

      MBeanServer platformMBeanServer =
          ManagementFactory.getPlatformMBeanServer();

      int jmxCounter = (int) platformMBeanServer
          .getAttribute(objectName, "Counter");
      Assert.assertEquals(counter, jmxCounter);
    } finally {
      if (objectName != null) {
        MBeans.unregister(objectName);
      }
    }
  }