}
@Test
public void testAddRemoveAddRemove() {
// start with 4
EurekaInstance a1 = EurekaInstance.create(InstanceInfo.Builder.newBuilder()
.setAppName("api").setHostName("hostname1").setStatus(InstanceStatus.UP).build());
EurekaInstance a2 = EurekaInstance.create(InstanceInfo.Builder.newBuilder()
.setAppName("api").setHostName("hostname2").setStatus(InstanceStatus.UP).build());
EurekaInstance a3 = EurekaInstance.create(InstanceInfo.Builder.newBuilder()
.setAppName("api").setHostName("hostname3").setStatus(InstanceStatus.UP).build());
EurekaInstance a4 = EurekaInstance.create(InstanceInfo.Builder.newBuilder()
.setAppName("api").setHostName("hostname4").setStatus(InstanceStatus.UP).build());
Observable<List<EurekaInstance>> first = Observable.just(a1, a2, a3, a4).toList();
// mark one of them as DOWN
EurekaInstance b4 = EurekaInstance.create(InstanceInfo.Builder.newBuilder()
.setAppName("api").setHostName("hostname4").setStatus(InstanceStatus.DOWN).build());
Observable<List<EurekaInstance>> second = Observable.just(a1, a2, a3, b4).toList();
// then completely drop 2 of them
Observable<List<EurekaInstance>> third = Observable.just(a1, a2).toList();