Say I have a class named NameGenerator. I can use this to generate names according to a given logic. Then I write a TestNameGeneration class with a
NameGenerator
TestNameGeneration
What about a strategy pattern? It could be a better solution for your problem instead of using classloaders.