PassthroughLoadBalancerService implements LoadBalancerService { @Override public LoadBalancerInstance create(LoadBalancerSpec spec, boolean force) { var real = spec.reals().stream() .min(Comparator.naturalOrder()) .orElseThrow(() -> new IllegalArgumentException("No reals given")); return new LoadBalancerInstance(real.hostname(), Optional.empty(), Set.of(real.port()), Set.of(real.ipAddress() + "/32"), Set.of()); }  @Override LoadBalancerInstance create(LoadBalancerSpec spec, boolean force); @Override void remove(ApplicationId application, ClusterSpec.Id cluster); @Override Protocol protocol();  }
@Test public void create() { var lbService = new PassthroughLoadBalancerService(); var real = new Real(HostName.from("host1.example.com"), "192.0.2.10"); var reals = Set.of(real, new Real(HostName.from("host2.example.com"), "192.0.2.11")); var instance = lbService.create(new LoadBalancerSpec(ApplicationId.from("tenant1", "app1", "default"), ClusterSpec.Id.from("c1"), reals), false); assertEquals(real.hostname(), instance.hostname()); assertEquals(Set.of(real.port()), instance.ports()); assertEquals(Set.of(real.ipAddress() + "/32"), instance.networks()); }