ClassLoader classLoader = new URLClassLoader(new URL[0]);
Class<ClassInterceptedClass> proxyClass = pf.createProxyClass(classLoader, ClassInterceptedClass.class);
Assert.assertNotNull(proxyClass);
ClassInterceptedClass internalInstance = new ClassInterceptedClass();
internalInstance.init();
TestContextualInstanceProvider provider = new TestContextualInstanceProvider(internalInstance);
ClassInterceptedClass proxy = pf.createProxyInstance(proxyClass, provider);
Assert.assertEquals(42, proxy.getMeaningOfLife());
Assert.assertTrue(provider.gotInvoked());
Assert.assertEquals(internalInstance.getFloat(), proxy.getFloat(), 0f);
Assert.assertTrue(provider.gotInvoked());
Assert.assertEquals('c', proxy.getChar());
Assert.assertTrue(provider.gotInvoked());
Assert.assertEquals(internalInstance, proxy.getSelf());
Assert.assertTrue(provider.gotInvoked());
try
{
proxy.doThaBlowup();
Assert.fail("NumberFormatException expected!");
}
catch (NumberFormatException nfe)
{
Assert.assertEquals("should fit", nfe.getMessage());