@Test
public void testOnEvent() throws Exception {

    URL connectionURL = URL.valueOf("file:///Users/Home");
    ServiceDiscovery serviceDiscovery = new FileSystemServiceDiscovery();
    serviceDiscovery.initialize(connectionURL);
    // ServiceDiscoveryStartingEvent
    listener.onEvent(new ServiceDiscoveryInitializingEvent(serviceDiscovery, serviceDiscovery));
    // ServiceDiscoveryStartedEvent
    listener.onEvent(new ServiceDiscoveryInitializedEvent(serviceDiscovery, serviceDiscovery));
    // ServiceInstancePreRegisteredEvent
    listener.onEvent(new ServiceInstancePreRegisteredEvent(serviceDiscovery, createInstance()));
    // ServiceInstanceRegisteredEvent
    listener.onEvent(new ServiceInstanceRegisteredEvent(serviceDiscovery, createInstance()));
    // ServiceInstancesChangedEvent
    listener.onEvent(new ServiceInstancesChangedEvent("test", Arrays.asList(createInstance())));
    // ServiceInstancePreUnregisteredEvent
    listener.onEvent(new ServiceInstancePreUnregisteredEvent(serviceDiscovery, createInstance()));
    // ServiceInstanceUnregisteredEvent
    listener.onEvent(new ServiceInstanceUnregisteredEvent(serviceDiscovery, createInstance()));
    // ServiceDiscoveryStoppingEvent
    listener.onEvent(new ServiceDiscoveryDestroyingEvent(serviceDiscovery, serviceDiscovery));
    // ServiceDiscoveryStoppedEvent
    listener.onEvent(new ServiceDiscoveryDestroyedEvent(serviceDiscovery, serviceDiscovery));
}