richardcloudsoft/jclouds — comment on commit 1b80b286137655f1626aaad8d0e4a0b370cd0eae
File: apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/strategy/CloudStackComputeServiceAdapter.java line 129
By jclouds:

to make this more testable, you could weave in something like Map

the function could then hold the logic below.

so the usage would be..

checkState(optionsConverters.containsKey(zone.getNetworkType()), "no options converter configured for network type %s",zone.getNetworkType());

DeployVirtualMachineOptions options = optionsConverters.get(zone.getNetworkType()).apply(templateOptions).displayName(name).name(name);

Test wise, you can easily test the functions without mocks or anything. You'd weave this in by adding in something like this to the CloudStackComputeServiceContextModule:

\@Provides
\@Singleton
Map optionsConverters(AdvancedNetworkingOptionsConverter advancedNetworkingOptionsConverter, BasicNetworkingOptionsConverter basicNetworkingOptionsConverter){
return ImmutableMap.of(NetworkType.ADVANCED....