### Question:
ApplicationRegistry { @Nullable protected BuildVersion getBuildVersion(List<Instance> instances) { List<BuildVersion> versions = instances.stream().map(Instance::getBuildVersion).filter(Objects::nonNull) .distinct().sorted().collect(toList()); if (versions.isEmpty()) { return null; } else if (versions.size() == 1) { return versions.get(0); } else { return BuildVersion.valueOf(versions.get(0) + " ... " + versions.get(versions.size() - 1)); } } ApplicationRegistry(InstanceRegistry instanceRegistry, InstanceEventPublisher instanceEventPublisher); Flux<Application> getApplications(); Mono<Application> getApplication(String name); Flux<Application> getApplicationStream(); Flux<InstanceId> deregister(String name);  }### Answer:
@Test public void getBuildVersion() { Instance instance1 = getInstance("App1", "0.1"); Instance instance2 = getInstance("App2", "0.2"); assertThat(this.applicationRegistry.getBuildVersion(Collections.emptyList())).isNull(); assertThat(this.applicationRegistry.getBuildVersion(Collections.singletonList(instance1))) .isEqualTo(BuildVersion.valueOf("0.1")); assertThat(this.applicationRegistry.getBuildVersion(Arrays.asList(instance1, instance2))) .isEqualTo(BuildVersion.valueOf("0.1 ... 0.2")); }