LoadBalancerFactory { public static LoadBalancer getLoadBalancer(ConsumerBootstrap consumerBootstrap) { return getLoadBalancer(consumerBootstrap, consumerBootstrap.getConsumerConfig().getLoadBalancer()); }  static LoadBalancer getLoadBalancer(ConsumerBootstrap consumerBootstrap); static LoadBalancer getLoadBalancer(ConsumerBootstrap consumerBootstrap, String loadBalancer);  }
@Test public void getLoadBalancer() throws Exception { ConsumerConfig consumerConfig = new ConsumerConfig().setBootstrap("test").setLoadBalancer("test"); ConsumerBootstrap bootstrap = Bootstraps.from(consumerConfig); Assert.assertEquals(LoadBalancerFactory.getLoadBalancer(bootstrap).getClass(), TestLoadBalancer.class); boolean error = false; try { consumerConfig.setLoadBalancer("xasdsa"); LoadBalancerFactory.getLoadBalancer(bootstrap); } catch (Exception e) { error = true; } Assert.assertTrue(error); }