### Question:
MessageProcessorSerializer { public static OMElement serializeMessageProcessor(OMElement parent, MessageProcessor processor) { OMElement processorElem = fac.createOMElement("messageProcessor", synNS); if (processor != null) { processorElem.addAttribute(fac.createOMAttribute("class", nullNS, processor.getClass().getName())); } else { handleException("Invalid processor. Provider is required"); } if (processor.getName() != null) { processorElem.addAttribute(fac.createOMAttribute("name", nullNS, processor.getName())); } else { handleException("Message store Name not specified"); } if (FORWARDING_PROCESSOR.equals(processor.getClass().getName())) { if (processor.getTargetEndpoint() != null) { processorElem.addAttribute(fac.createOMAttribute("targetEndpoint", nullNS, processor.getTargetEndpoint())); } else { } } if(processor.getMessageStoreName() != null) { processorElem.addAttribute(fac.createOMAttribute( "messageStore",nullNS,processor.getMessageStoreName())); } if (processor.getParameters() != null) { Iterator iterator = processor.getParameters().keySet().iterator(); while (iterator.hasNext()) { String name = (String) iterator.next(); String value; if (ForwardingProcessorConstants.NON_RETRY_STATUS_CODES.equals(name)) { Object statusCode = processor.getParameters().get(ForwardingProcessorConstants.NON_RETRY_STATUS_CODES); value = StringUtils.join((String[]) statusCode, ","); } else { value = (String) processor.getParameters().get(name); } OMElement property = fac.createOMElement("parameter", synNS); property.addAttribute(fac.createOMAttribute( "name", nullNS, name)); property.setText(value.trim()); processorElem.addChild(property); } } if (getSerializedDescription(processor) != null) { processorElem.addChild(getSerializedDescription(processor)); } if (parent != null) { parent.addChild(processorElem); } return processorElem; }  static OMElement serializeMessageProcessor(OMElement parent, MessageProcessor processor); static final String FORWARDING_PROCESSOR; }### Answer:
@Test(expected = SynapseException.class) public void testSerializeMessageProcessor() { MessageProcessor messageProcessor = new SamplingProcessor(); MessageProcessorSerializer.serializeMessageProcessor(null, messageProcessor); }
@Test public void testSerializeMessageProcessor2() { MessageProcessor messageProcessor = new SamplingProcessor(); messageProcessor.setName("testStore"); OMElement element = MessageProcessorSerializer.serializeMessageProcessor(null, messageProcessor); Assert.assertNotNull("OMElement is not returned", element); }
@Test public void testSerializeMessageProcessor3() { Map<String, Object> parameters = new HashMap<>(); MessageProcessor messageProcessor = new ScheduledMessageForwardingProcessor(); messageProcessor.setName("testStore"); parameters.put("interval", "1000"); messageProcessor.setParameters(parameters); messageProcessor.setDescription("testMessageProcessor"); messageProcessor.setTargetEndpoint("target"); messageProcessor.setMessageStoreName("testMessageStore"); OMElement element = MessageProcessorSerializer.serializeMessageProcessor(null, messageProcessor); Assert.assertNotNull("OMElement is not returned", element); }