}
}
// step 2.
// creating the Proxy Class itself
InterceptorDecoratorProxyFactory pf = new InterceptorDecoratorProxyFactory(getWebBeansContext());
// we take a fresh URLClassLoader to not blur the test classpath with synthetic classes.
ClassLoader classLoader = this.getClass().getClassLoader(); // new URLClassLoader(new URL[0]);
Method[] businessMethods = methodInterceptors.keySet().toArray(new Method[methodInterceptors.size()]);
Method[] nonInterceptedMethods = interceptorInfo.getNonInterceptedMethods().toArray(new Method[interceptorInfo.getNonInterceptedMethods().size()]);
Class<? extends ClassMultiInterceptedClass> proxyClass = pf.createProxyClass(bean, classLoader, ClassMultiInterceptedClass.class, businessMethods, nonInterceptedMethods);
Assert.assertNotNull(proxyClass);
// step 3.
// creating the InterceptorHandler for each intercepted instance later at runtime
Map<Interceptor<?>,Object> interceptorInstances = new HashMap<Interceptor<?>, Object>();
for (Interceptor interceptorBean : interceptorInfo.getCdiInterceptors())
{
Object interceptorInstance = interceptorBean.create(cc);
interceptorInstances.put(interceptorBean, interceptorInstance);
}
InterceptorHandler interceptorHandler
= new DefaultInterceptorHandler<ClassMultiInterceptedClass>(internalInstance, internalInstance, methodInterceptors, interceptorInstances, null);
ClassMultiInterceptedClass proxyInstance = pf.createProxyInstance(proxyClass, internalInstance, interceptorHandler);
Assert.assertNotNull(proxyInstance);
Assert.assertEquals(internalInstance, proxyInstance.getSelf());
proxyInstance.setMeaningOfLife(42);