@Test
public void testCanAdaptFinalResultReturnTypeObject() throws Exception
{
ClassLoader loader = MockService.class.getClassLoader();
final MockService internal = new MockService();
MockService delegate = (MockService) Enhancer.create(MockService.class, new LazyLoader()
{
@Override
public Object loadObject() throws Exception
{
return internal;
}
});
MockService adapter = ClassLoaderAdapterBuilder.callingLoader(loader).delegateLoader(loader)
.enhance(delegate, MockService.class);
Assert.assertNotEquals(internal.getResultFinalReturnTypeObject(), adapter.getResultFinalReturnTypeObject());
Assert.assertEquals(((Result) internal.getResultFinalReturnTypeObject()).getValue(),
((Result) adapter.getResultFinalReturnTypeObject()).getValue());
}