@Test
public void registerAtMBeanServer() throws MalformedObjectNameException, MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException {

    Config config = new Config(null,null,null);
    ObjectName oName = new ObjectName("jolokia:type=Config");
    ObjectInstance oInstance = new ObjectInstance(oName,Config.class.getName());
    MBeanServer server = EasyMock.createMock(MBeanServer.class);
    expect(server.registerMBean(eq(config),eq(oName))).andReturn(oInstance);
    replay(server);
    ObjectName resName = serverHandle.registerMBeanAtServer(server,config,"jolokia:type=Config");
    assertEquals(resName,oName);
    verify(server);
}