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

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