### Question:
EventPublisherMediatorSerializer extends AbstractMediatorSerializer { public OMElement serializeSpecificMediator(Mediator m) { if (!(m instanceof EventPublisherMediator)) { handleException("Unsupported mediator passed in for serialization : " + m.getType()); } EventPublisherMediator mediator = (EventPublisherMediator) m; OMElement elmEventPublisher = fac.createOMElement("eventPublisher", synNS); if (mediator.getEventSourceName() != null) { elmEventPublisher.addAttribute(fac.createOMAttribute( "eventSourceName", nullNS, mediator.getEventSourceName())); } else { handleException("Invalid EventPublisher mediator. Event Source Name required"); } saveTracingState(elmEventPublisher, mediator); serializeComments(elmEventPublisher, mediator.getCommentsList()); return elmEventPublisher; }  OMElement serializeSpecificMediator(Mediator m); String getMediatorClassName();  }### Answer:
@Test(expected = SynapseException.class) public void testCreateEventSource() { EventPublisherMediatorSerializer mediatorSerializer = new EventPublisherMediatorSerializer(); Mediator mediator = new CallMediator(); mediatorSerializer.serializeSpecificMediator(mediator); }
@Test(expected = SynapseException.class) public void testCreateEventSource1() { EventPublisherMediatorSerializer mediatorSerializer = new EventPublisherMediatorSerializer(); EventPublisherMediator mediator = new EventPublisherMediator(); mediatorSerializer.serializeSpecificMediator(mediator); }
@Test public void testCreateEventSource2() { EventPublisherMediatorSerializer mediatorSerializer = new EventPublisherMediatorSerializer(); EventPublisherMediator mediator = new EventPublisherMediator(); mediator.setEventSourceName("Test"); OMElement element = mediatorSerializer.serializeSpecificMediator(mediator); Assert.assertEquals("Name should be eventPublisher", "eventPublisher", element.getLocalName()); }