> The test checks that setConf() is called by inspecting the script filename is correct (which is passed through the conf).
I see. RackResolver.getDnsToSwitchMapping() is a new method that is just used by the test. Generally it's not a good idea to add things that are only used by tests, but maybe a getter is harmless. You could make it package private though and add a comment saying it is for tests, or add @VisibleForTesting.
> The reason for adding a new test class is that RackResolver.init() is a static method, and it checks if it was called before and returns.
The fact that RackResolver has static state is a deeper problem, which putting the test into another class doesn't solve. What if TestRackResolver runs before TestRackResolverScriptBasedMapping? Can we make RackResolver non-static?
> DNSToSwitchMapping is not Configurable.
No, but ScriptBasedMapping is. You don't need to change the DNSToSwitchMapping interface.