}
private void doTestManageManagedEndpoint(Exception ex) throws Exception {
ObjectName name = new ObjectName(ENDPOINT_NAME);
ObjectInstance instance = new ObjectInstance(name, Nameable.class.getName());
InternalEndpoint internal = control.createMock(InternalEndpoint.class);
ManagedEndpoint endpoint =
new ManagedEndpoint(internal, strategy);
expect(internal.getId()).andReturn("endpoint_foo");
expect(mbeanServer.registerMBean(isA(ManagedEndpoint.class), eq(name))).andReturn(instance);
control.replay();
strategy.manageObject(endpoint);
strategy.manageObject(endpoint);
control.verify();