### Question:
RMEndpoint { void initialise(RMConfiguration config, Conduit c, EndpointReferenceType r, org.apache.cxf.transport.Destination d, Message message) { configuration = config; conduit = c; replyTo = r; createServices(); createEndpoints(d); setPolicies(message); if (manager != null && manager.getBus() != null) { managedEndpoint = new ManagedRMEndpoint(this); instrumentationManager = manager.getBus().getExtension(InstrumentationManager.class); if (instrumentationManager != null) { ModelMBeanAssembler assembler = new ModelMBeanAssembler(); ModelMBeanInfo mbi = assembler.getModelMbeanInfo(managedEndpoint.getClass()); MBeanServer mbs = instrumentationManager.getMBeanServer(); if (mbs == null) { LOG.log(Level.WARNING, "MBeanServer not available."); } else { try { RequiredModelMBean rtMBean = (RequiredModelMBean)mbs.instantiate("javax.management.modelmbean.RequiredModelMBean"); rtMBean.setModelMBeanInfo(mbi); try { rtMBean.setManagedResource(managedEndpoint, "ObjectReference"); } catch (InvalidTargetObjectTypeException itotex) { throw new JMException(itotex.getMessage()); } ObjectName name = managedEndpoint.getObjectName(); instrumentationManager.register(rtMBean, name); modelMBean = rtMBean; } catch (JMException jmex) { LOG.log(Level.WARNING, "Registering ManagedRMEndpoint failed.", jmex); } } } } } RMEndpoint(RMManager m, Endpoint ae); RMManager getManager(); Endpoint getApplicationEndpoint(); Endpoint getEndpoint(ProtocolVariation protocol); Service getService(ProtocolVariation protocol); BindingInfo getBindingInfo(ProtocolVariation protocol); Proxy getProxy(); Servant getServant(); Destination getDestination(); void setDestination(Destination destination); Source getSource(); void setSource(Source source); long getLastApplicationMessage(); int getApplicationMessageCount(); void receivedApplicationMessage(); long getLastControlMessage(); int getControlMessageCount(); void receivedControlMessage(); Conduit getConduit(); RMConfiguration getConfiguration(); void handleAccept(String ssid, long number, Message msg); void handleAcknowledgment(String ssid, long number, Message msg);  }### Answer:
@Test public void testInitialise() throws NoSuchMethodException { Message m = new MessageImpl(); Method m1 = RMEndpoint.class.getDeclaredMethod("createServices", new Class[] {}); Method m2 = RMEndpoint.class .getDeclaredMethod("createEndpoints", new Class[] {org.apache.cxf.transport.Destination.class}); Method m3 = RMEndpoint.class.getDeclaredMethod("setPolicies", new Class[] {Message.class}); rme = EasyMock.createMockBuilder(RMEndpoint.class) .addMockedMethods(m1, m2, m3).createMock(control); rme.createServices(); EasyMock.expectLastCall(); rme.createEndpoints(null); EasyMock.expectLastCall(); rme.setPolicies(m); EasyMock.expectLastCall(); Conduit c = control.createMock(Conduit.class); EndpointReferenceType epr = control.createMock(EndpointReferenceType.class); control.replay(); rme.initialise(new RMConfiguration(), c, epr, null, m); assertSame(c, rme.getConduit()); assertSame(epr, rme.getReplyTo()); }