### Question:
EndpointDetectionTrigger extends AbstractEventHandler<InstanceEvent> { protected Mono<Void> detectEndpoints(InstanceEvent event) { return endpointDetector.detectEndpoints(event.getInstance()); } EndpointDetectionTrigger(EndpointDetector endpointDetector, Publisher<InstanceEvent> publisher);   }### Answer:
@Test public void should_detect_on_status_changed() { events.next(new InstanceStatusChangedEvent(instance.getId(), instance.getVersion(), StatusInfo.ofDown())); verify(detector, times(1)).detectEndpoints(instance.getId()); }
@Test public void should_detect_on_registration_updated() { events.next( new InstanceRegistrationUpdatedEvent(instance.getId(), instance.getVersion(), instance.getRegistration())); verify(detector, times(1)).detectEndpoints(instance.getId()); }
@Test public void should_not_detect_on_non_relevant_event() { events.next(new InstanceRegisteredEvent(instance.getId(), instance.getVersion(), instance.getRegistration())); verify(detector, never()).detectEndpoints(instance.getId()); }
@Test public void should_not_detect_on_trigger_stopped() { trigger.stop(); clearInvocations(detector); events.next(new InstanceRegisteredEvent(instance.getId(), instance.getVersion(), instance.getRegistration())); verify(detector, never()).detectEndpoints(instance.getId()); }