@Test
public void testEventOnServerUpdate() {

    instanceSet0.set(0, instanceSet0.get(0).toBuilder().withHostname("changed").build());
    when(agentCache.getAgentInstances(instanceGroups.get(0).getId())).thenReturn(new HashSet<>(instanceSet0));
    agentCacheEventSubject.onNext(new CacheUpdateEvent(CacheUpdateType.Instance, instanceSet0.get(0).getId()));
    AgentEvent event = eventSubscriber.takeNext();
    assertThat(event).isInstanceOf(AgentInstanceUpdateEvent.class);
}