@Test
public void testEventOnServerRemoved() {

    String id = instanceSet0.get(0).getId();
    instanceSet0.remove(0);
    when(agentCache.getAgentInstances(instanceGroups.get(0).getId())).thenReturn(new HashSet<>(instanceSet0));
    agentCacheEventSubject.onNext(new CacheUpdateEvent(CacheUpdateType.Instance, id));
    AgentEvent event = eventSubscriber.takeNext();
    assertThat(event).isInstanceOf(AgentInstanceRemovedEvent.class);
}