### Question:
RecipientListEndpoint extends AbstractEndpoint { private void sendToEndpointList(MessageContext synCtx, List<Endpoint> children) { int i = 0; boolean foundEndpoint = false; try { RelayUtils.buildMessage(((Axis2MessageContext) synCtx).getAxis2MessageContext(),false); } catch (Exception e) { handleException("Error while building message", e, synCtx); } for (Endpoint childEndpoint : children) { if (childEndpoint.readyToSend()) { foundEndpoint = true; MessageContext newCtx = null; try { newCtx = MessageHelper.cloneMessageContext(synCtx); } catch (AxisFault e) { handleException("Error cloning the message context", e, synCtx); } newCtx.setProperty(EIPConstants.MESSAGE_SEQUENCE, String.valueOf(i++) + EIPConstants.MESSAGE_SEQUENCE_DELEMITER + children.size()); evaluateProperties(newCtx); newCtx.pushFaultHandler(this); try { childEndpoint.send(newCtx); } catch (SynapseException e) { String msg ="Child Endpoint " + (childEndpoint.getName() != null ? childEndpoint.getName() : SynapseConstants.ANONYMOUS_ENDPOINT) + " of Recipient List endpoint " + (getName() != null ? getName() : SynapseConstants.ANONYMOUS_ENDPOINT) + " encountered an error while sending the message"; log.warn(msg); continue; } } } if (!foundEndpoint) { String msg = "Recipient List endpoint : " + (getName() != null ? getName() : SynapseConstants.ANONYMOUS_ENDPOINT) + " - no ready child endpoints"; log.warn(msg); informFailure(synCtx, SynapseConstants.ENDPOINT_RL_NONE_READY, msg); } } RecipientListEndpoint(int poolsize);  RecipientListEndpoint(); @Override void init(SynapseEnvironment synapseEnvironment); @Override void destroy(); @Override void send(MessageContext synCtx); void sendMessage(MessageContext synCtx); @Override boolean readyToSend(); void onChildEndpointFail(Endpoint endpoint, MessageContext synMessageContext); List<Member> getMembers(); void setMembers(List<Member> members); boolean isFailover(); void setFailover(boolean failover); Value getDynamicEnpointSet(); void setDynamicEnpointSet(Value dynamicEnpointSet); int getCurrentPoolSize(); final static int DEFAULT_MAX_POOL; }### Answer:
@Test public void testSendToEndpointList() throws Exception { OMElement omBody = AXIOMUtil.stringToOM("<endpoint><recipientlist xmlns=\"http: " <endpoint xmlns=\"http: " <address uri=\"http: " </endpoint>\n" + " <endpoint xmlns=\"http: " <address uri=\"http: " </endpoint>\n" + "</recipientlist></endpoint>"); RecipientListEndpoint recipientListEndpoint = (RecipientListEndpoint) EndpointFactory. getEndpointFromElement(omBody,true, null); Axis2SynapseEnvironment synapseEnvironment = getMockedSynapseEnvironment(); Mockito.when(synapseEnvironment.createMessageContext()).thenReturn(createMessageContext()); String samplePayload = "<test><a>WSO2</a></test>"; Axis2MessageContext messageContext = getMessageContext(samplePayload); messageContext.setEnvironment(synapseEnvironment); recipientListEndpoint.init(synapseEnvironment); recipientListEndpoint.sendMessage(messageContext); }