@Test
public void testEventOnServerRemovedAndGroupRefresh() {

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