	@Test
	public void shouldDispatchEventWhenServiceInstanceDisappeared() {

		when(this.discoveryClient.getServices()).thenReturn(Collections.singletonList("a"));
		when(this.catalog.getApplications()).thenReturn(Collections.singletonList("a"));
		ServiceInstance serviceInstance = new DefaultServiceInstance("a-1", "a", "host", 8080, false);
		when(this.discoveryClient.getInstances("a")).thenReturn(Collections.singletonList(serviceInstance));
		when(this.catalog.getApplicationInstancesForApplication("a")).thenReturn(Arrays.asList("a-1", "a-2"));

		this.landscapeWatcher.discoverLandscape();

		verify(this.catalogService, times(2)).getCatalog();
		verifyNoMoreInteractions(this.catalogService);

		verify(this.discoveryClient).getServices();
		verify(this.discoveryClient).getInstances("a");
		verifyNoMoreInteractions(this.discoveryClient);

		verify(this.publisher).publishEvent(this.applicationEventArgumentCaptor.capture());
		verifyNoMoreInteractions(this.publisher);
		ApplicationEvent event = this.applicationEventArgumentCaptor.getValue();
		assertThat(event).isInstanceOfSatisfying(ServiceInstanceDisappeared.class,
				e -> assertThat(e.getSource()).isEqualTo("a-2"));
	}