### Question:
MediatorPropertySerializer { public static void serializeMediatorProperties(OMElement parent, Collection<MediatorProperty> props) { serializeMediatorProperties(parent, props, PROP_Q); }  static void serializeMediatorProperties(OMElement parent,
                                               Collection<MediatorProperty> props); static void serializeMediatorProperties(OMElement parent,
                                               Collection<MediatorProperty> props,
                                               QName childElementName); static void serializeMediatorProperty(OMElement parent,
                                             MediatorProperty mp); static void serializeMediatorProperty(OMElement parent,
                                             MediatorProperty mp,
                                             QName childElementName);  }### Answer:
@Test public void testSerializeMediatorProperties() throws XMLStreamException { OMElement element = AXIOMUtil.stringToOM(XML); List<MediatorProperty> propertyList = new ArrayList<>(); MediatorProperty property = new MediatorProperty(); property.setName(NAME); property.setValue(VALUE); propertyList.add(property); MediatorPropertySerializer.serializeMediatorProperties(element, propertyList); OMElement firstElement = element.getFirstElement(); Assert.assertEquals("name of property must be added as an attribute", NAME, firstElement.getAttribute(new QName("name")).getAttributeValue()); Assert.assertEquals("value of property must be added as an attribute", VALUE, firstElement.getAttribute(new QName("value")).getAttributeValue()); }
@Test public void testSerializeWithoutPropertyName() throws XMLStreamException { OMElement element = AXIOMUtil.stringToOM(XML); List<MediatorProperty> propertyList = new ArrayList<>(); MediatorProperty property = new MediatorProperty(); propertyList.add(property); thrown.expect(SynapseException.class); thrown.expectMessage("Mediator property name missing"); MediatorPropertySerializer.serializeMediatorProperties(element, propertyList); }
@Test public void testSerializeWithoutPropertyValue() throws XMLStreamException { OMElement element = AXIOMUtil.stringToOM(XML); List<MediatorProperty> propertyList = new ArrayList<>(); MediatorProperty property = new MediatorProperty(); property.setName(NAME); propertyList.add(property); thrown.expect(SynapseException.class); thrown.expectMessage("Mediator property must have a literal value or be an expression"); MediatorPropertySerializer.serializeMediatorProperties(element, propertyList); }