### Question:
ServiceRegistration extends AbstractServiceRegistration { @Override public void introduceServiceToEV(ExecutionVenue ev, ServiceRegistrar serviceRegistrar, CompoundExecutableResolver compoundExecutableResolver) { super.introduceServiceToEV(ev, serviceRegistrar, compoundExecutableResolver); if (eventTransports != null && !eventTransports.isEmpty()) { for (final EventTransport eventTransport : eventTransports) { for (OperationDefinition opDef : getServiceDefinition().getOperationDefinitions(OperationKey.Type.Event)) { ev.execute(eventTransport.getExecutionContext(), opDef.getOperationKey(), new Object[0], new ExecutionObserver() { @Override public void onResult(ExecutionResult result) { eventTransport.publish((Event)result.getResult()); } }, DefaultTimeConstraints.NO_CONSTRAINTS); } } } }  @Override void introduceServiceToEV(ExecutionVenue ev, ServiceRegistrar serviceRegistrar, CompoundExecutableResolver compoundExecutableResolver); void introduceServiceToTransports(Iterator<? extends BindingDescriptorRegistrationListener> transports); void setEventTransports(Set<EventTransport> eventTransportSet);  }### Answer:
@Test public void testIntroductionToEV() { OperationDefinition[] opDefs = new OperationDefinition[] { new SimpleOperationDefinition( new OperationKey(new ServiceVersion("v1.0"), "testService", "event", OperationKey.Type.Event), null, null) }; when(serviceDefinition.getOperationDefinitions(any(OperationKey.Type.class))).thenReturn(opDefs); cut.introduceServiceToEV(ev, ev, compoundExecutableResolver); verify((ServiceRegistrar)ev).registerService(eq((String) null), eq(serviceDefinition), eq(service), eq(compoundExecutableResolver)); ArgumentCaptor<OperationKey> keyCaptor = ArgumentCaptor.forClass(OperationKey.class); verify(ev).execute(any(ExecutionContext.class), keyCaptor.capture(), any(Object[].class), any(ExecutionObserver.class), eq(DefaultTimeConstraints.NO_CONSTRAINTS)); assertTrue(keyCaptor.getValue().getType() == OperationKey.Type.Event); }
@Test public void testIntroductionToEVWithNamespace() { OperationDefinition[] opDefs = new OperationDefinition[] { new SimpleOperationDefinition( new OperationKey(new ServiceVersion("v1.0"), "testService", "event", OperationKey.Type.Event), null, null) }; when(serviceDefinition.getOperationDefinitions(any(OperationKey.Type.class))).thenReturn(opDefs); cut.setNamespace("foo"); cut.introduceServiceToEV(ev, ev, compoundExecutableResolver); verify((ServiceRegistrar)ev).registerService(eq("foo"), eq(serviceDefinition), eq(service),eq(compoundExecutableResolver)); ArgumentCaptor<OperationKey> keyCaptor = ArgumentCaptor.forClass(OperationKey.class); verify(ev).execute(any(ExecutionContext.class), keyCaptor.capture(), any(Object[].class), any(ExecutionObserver.class), eq(DefaultTimeConstraints.NO_CONSTRAINTS)); assertTrue(keyCaptor.getValue().getType() == OperationKey.Type.Event); assertEquals(null, keyCaptor.getValue().getNamespace()); }