router.setRoutes(endpoints);
MuleMessage message = new DefaultMuleMessage("test,mule,message", muleContext);
assertTrue(router.isMatch(message));
when(mockendpoint1.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer());
when(mockendpoint2.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer());
when(mockendpoint3.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer());
MuleSession session = mock(MuleSession.class);
router.route(new OutboundRoutingTestEvent(message, session, muleContext));
endpoints = new ArrayList<MessageProcessor>();
endpoints.add(mockendpoint4);
endpoints.add(mockendpoint5);
endpoints.add(mockendpoint6);
router.getRoutes().clear();
router.setRoutes(endpoints);
message = new DefaultMuleMessage("test,mule,message", muleContext);
MuleEvent event = new OutboundRoutingTestEvent(message, null, muleContext);
when(mockendpoint4.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer(event));
when(mockendpoint5.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer(event));
when(mockendpoint6.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer(event));
MuleEvent result = router.route(new OutboundRoutingTestEvent(message, session, muleContext));
assertNotNull(result);
MuleMessage resultMessage = result.getMessage();
assertNotNull(resultMessage);