farhan5248 / sheep-dog-tools

Eclipse and Maven plug-ins to help manual testers support developers adopting bdd and tdd using lean principles and model based testing
GNU General Public License v3.0
0 stars 0 forks source link

Make one consistent Factory method #72

Closed farhan5248 closed 8 months ago

farhan5248 commented 8 months ago

First make all the common GraphTestObject and GraphTestObjectFactory consistent across the 3 projects. Then given an interface name and package name, it should find the interface. Then it should find any class in the same package that implements that interface.

farhan5248 commented 8 months ago

I don't think I need to load the class in this method, just get the list of them. If I'm not loading the class, I won't need the IOException

public Set<Class> findAllClassesUsingGoogleGuice(String packageName) throws IOException {
    return ClassPath.from(ClassLoader.getSystemClassLoader()).getAllClasses().stream()
            .filter(testObj-> testObj.getPackageName().equalsIgnoreCase(packageName)).map(testObj-> testObj.load())
            .collect(Collectors.toSet());
}

Set<Class> classes = findAllClassesUsingGoogleGuice("org.farhan.tests.validating");