### Question:
EventPublisherMediator extends AbstractMediator { public boolean mediate(MessageContext synCtx) { if (synCtx.getEnvironment().isDebuggerEnabled()) { if (super.divertMediationRoute(synCtx)) { return true; } } if (log.isDebugEnabled()) { log.debug("Mediation for Event Publisher started"); } SynapseEventSource eventSource = synCtx.getConfiguration().getEventSource(eventSourceName); eventSource.dispatchEvents(synCtx); return true; }  boolean mediate(MessageContext synCtx); String getEventSourceName(); void setEventSourceName(String eventSourceName);  }### Answer:
@Test public void testMediate() { final String EventSourceName = "testEventStore"; SynapseEnvironment synapseEnvironment = Mockito.mock(SynapseEnvironment.class); MessageContext messageContext = new TestMessageContext(); messageContext.setEnvironment(synapseEnvironment); SynapseConfiguration synapseConfiguration = new SynapseConfiguration(); SynapseEventSource synapseEventSource = Mockito.mock(SynapseEventSource.class); Mockito.doNothing().when(synapseEventSource).dispatchEvents(Mockito.any(MessageContext.class)); Map<String, SynapseEventSource> eventStoreMap = new HashMap<>(); eventStoreMap.put(EventSourceName, synapseEventSource); synapseConfiguration.setEventSources(eventStoreMap); messageContext.setConfiguration(synapseConfiguration); eventPublisherMediator.setEventSourceName(EventSourceName); Assert.assertTrue("mediation successful", eventPublisherMediator.mediate(messageContext)); }