### Question:
SCAInvoker extends BaseServiceHandler { LoadBalanceStrategy createLoadBalancer(String strategy) { if (RoundRobinStrategy.class.getSimpleName().equals(strategy)) { return new RoundRobinStrategy(); } else if (RandomStrategy.class.getSimpleName().equals(strategy)) { return new RandomStrategy(); } else { try { Class<?> strategyClass = Class.forName(strategy); if (!LoadBalanceStrategy.class.isAssignableFrom(strategyClass)) { throw SCAMessages.MESSAGES.loadBalanceClassDoesNotImplementLoadBalanceStrategy(strategy); } return (LoadBalanceStrategy)strategyClass.newInstance(); } catch (Exception ex) { throw SCAMessages.MESSAGES.unableToInstantiateStrategyClass(strategy, ex); } } } SCAInvoker(SCABindingModel config);  SCAInvoker(SCABindingModel config, RemoteRegistry registry); @Override void handleMessage(Exchange exchange); SCAInvoker setDisableRemoteTransaction(boolean disable);  }### Answer:
@Test public void createOOTBLoadBalancers() throws Exception { V1SCABindingModel config = new V1SCABindingModel(SwitchYardNamespace.DEFAULT.uri()) { @Override public String getName() { return "testBinding"; } public CompositeReferenceModel getReference() { return new V1CompositeReferenceModel(); }; }; SCAInvoker invoker = new SCAInvoker(config); invoker.start(); LoadBalanceStrategy roundRobin = invoker.createLoadBalancer("RoundRobinStrategy"); Assert.assertTrue(roundRobin instanceof RoundRobinStrategy); LoadBalanceStrategy random = invoker.createLoadBalancer("RandomStrategy"); Assert.assertTrue(random instanceof RandomStrategy); }
@Test public void createCustomLoadBalancers() throws Exception { V1SCABindingModel config = new V1SCABindingModel(SwitchYardNamespace.DEFAULT.uri()) { @Override public String getName() { return "testBinding"; } public CompositeReferenceModel getReference() { return new V1CompositeReferenceModel(); }; }; SCAInvoker invoker = new SCAInvoker(config); invoker.start(); LoadBalanceStrategy lb = invoker.createLoadBalancer("org.switchyard.component.sca.MyLoadBalancer"); Assert.assertTrue(lb instanceof MyLoadBalancer); try { invoker.createLoadBalancer("org.foo.Bar"); Assert.fail("Should not be able to create a bogus load balance strategy"); } catch (SwitchYardException ex) { } }