// Path: src/main/java/br/com/six2six/fixturefactory/util/ClassLoaderUtils.java
// public static Set<Class<?>> getClassesForPackage(String packageName) {
// 	Set<Class<?>> classes = new HashSet<Class<?>>();
// 
// 	JarInputStream jarInputStream = null;
// 	try {
// 		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// 
// 		Enumeration<URL> resources = classLoader.getResources(packageName.replace('.', '/'));
// 		while (resources.hasMoreElements()) {
// 			URL res = resources.nextElement();
// 
// 			if (res.getProtocol().matches("(jar|zip)")) {
// 				res = new URL((res.getProtocol().equals("zip") || !res.getFile().contains("file:")  ? 
// 						"file:".concat(res.getFile().startsWith("/") ? "": "/") : "").concat(res.getFile().split("!")[0]));
// 			}
// 			if (res.getFile().contains(".jar")) {
// 				jarInputStream = new JarInputStream(res.openStream());
// 				JarEntry entry = jarInputStream.getNextJarEntry();
// 
// 
// 				while (entry != null) {
// 					if (entry.getName().startsWith(packageName.replace('.', '/')) && entry.getName().endsWith(".class") && !entry.getName().contains("$")) {
// 						classes.add(Class.forName(entry.getName().replace(".class","").replace("/",".")));
// 					}
// 
// 					entry = jarInputStream.getNextJarEntry();
// 				}
// 			} else {
// 				classes.addAll(scanClassesFromDirectory(new File(URLDecoder.decode(res.getPath(), "UTF-8")), packageName));
// 			}   
// 		}
// 	} catch (Exception x) {
// 		throw new IllegalArgumentException("invalid package");
// 	} finally {
// 		if(jarInputStream != null){
// 			try {
// 				jarInputStream.close();
// 			} catch (IOException e) {
// 				throw new IllegalStateException(e.getMessage());
// 			}
// 		}
// 	}
// 
// 	return classes;
// }


import static br.com.six2six.fixturefactory.util.ClassLoaderUtils.getClassesForPackage;
package br.com.six2six.fixturefactory.loader;


public class FixtureFactoryLoader {

	public static void loadTemplates(String basePackage) {
// Path: src/main/java/br/com/six2six/fixturefactory/util/ClassLoaderUtils.java
// public static Set<Class<?>> getClassesForPackage(String packageName) {
// 	Set<Class<?>> classes = new HashSet<Class<?>>();
// 
// 	JarInputStream jarInputStream = null;
// 	try {
// 		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// 
// 		Enumeration<URL> resources = classLoader.getResources(packageName.replace('.', '/'));
// 		while (resources.hasMoreElements()) {
// 			URL res = resources.nextElement();
// 
// 			if (res.getProtocol().matches("(jar|zip)")) {
// 				res = new URL((res.getProtocol().equals("zip") || !res.getFile().contains("file:")  ? 
// 						"file:".concat(res.getFile().startsWith("/") ? "": "/") : "").concat(res.getFile().split("!")[0]));
// 			}
// 			if (res.getFile().contains(".jar")) {
// 				jarInputStream = new JarInputStream(res.openStream());
// 				JarEntry entry = jarInputStream.getNextJarEntry();
// 
// 
// 				while (entry != null) {
// 					if (entry.getName().startsWith(packageName.replace('.', '/')) && entry.getName().endsWith(".class") && !entry.getName().contains("$")) {
// 						classes.add(Class.forName(entry.getName().replace(".class","").replace("/",".")));
// 					}
// 
// 					entry = jarInputStream.getNextJarEntry();
// 				}
// 			} else {
// 				classes.addAll(scanClassesFromDirectory(new File(URLDecoder.decode(res.getPath(), "UTF-8")), packageName));
// 			}   
// 		}
// 	} catch (Exception x) {
// 		throw new IllegalArgumentException("invalid package");
// 	} finally {
// 		if(jarInputStream != null){
// 			try {
// 				jarInputStream.close();
// 			} catch (IOException e) {
// 				throw new IllegalStateException(e.getMessage());
// 			}
// 		}
// 	}
// 
// 	return classes;
// }


// Path: src/main/java/br/com/six2six/fixturefactory/loader/FixtureFactoryLoader.java
import static br.com.six2six.fixturefactory.util.ClassLoaderUtils.getClassesForPackage;

package br.com.six2six.fixturefactory.loader;


public class FixtureFactoryLoader {

	public static void loadTemplates(String basePackage) {
        for (Class<?> clazz : getClassesForPackage(basePackage)) {