List<Class<?>> toCheck = new ArrayList<Class<?>>();
toCheck.add(String.class);
toCheck.add(Object.class);
entryDelegate.checkClasses(new StaticServiceRegistryEntry("service", "bean", "module", toCheck, null, classLoader));
try {
//now create CustomClassLoader
final URLClassLoader exceptionClassLoader = new URLClassLoader(new URL[0]){
@Override
protected synchronized Class<?> loadClass(String arg0, boolean arg1)
throws ClassNotFoundException {
throw new ClassNotFoundException();
}
};
entryDelegate.checkClasses(new StaticServiceRegistryEntry("service", "bean", "module", toCheck, null, exceptionClassLoader));
fail();
} catch (InvalidStateException e) {
System.out.println(e.getMessage());
assertTrue(e.getMessage().startsWith("Class entry 'java.lang.String' contributed from module 'module' with bean name 'bean' could not be found using class loader"));
}