### Question:
EurekaInstanceCanceledListener { @EventListener public void listen(EurekaInstanceCanceledEvent event) { gatewayNotifier.serviceCancelledRegistration(EurekaUtils.getServiceIdFromInstanceId(event.getServerId())); }  @EventListener void listen(EurekaInstanceCanceledEvent event);  }### Answer:
@Test public void testListen() { GatewayNotifier notifier = mock(GatewayNotifier.class); EurekaInstanceCanceledListener listener = new EurekaInstanceCanceledListener(notifier); listener.listen(createEvent("host:service:instance")); verify(notifier, times(1)).serviceCancelledRegistration("service"); listener.listen(createEvent("unknown format")); verify(notifier, times(1)).serviceCancelledRegistration(null); }