PersistenceDelegator delegator = CoreTestUtilities.getDelegator(em);
PersonnelDTO dto = new PersonnelDTO("1", "vivek", "mishra");
em.persist(dto);
LazyInitializerFactory factory = kunderaMetadata.getCoreMetadata().getLazyInitializerFactory();
KunderaProxy proxy = factory.getProxy("personnel#1", PersonnelDTO.class, null, null, "1", delegator);
LazyInitializer li = proxy.getKunderaLazyInitializer();
((CglibLazyInitializer)li).setPersistenceDelegator(delegator);
li.setImplementation(proxy);
li.initialize();
Assert.assertNotNull(((CglibLazyInitializer)li).getTarget());
Assert.assertNotNull(((CglibLazyInitializer)li).getEntityName());
Assert.assertEquals("personnel#1",((CglibLazyInitializer)li).getEntityName());
Assert.assertNotNull(li.getPersistenceDelegator());
Assert.assertSame(delegator,li.getPersistenceDelegator());
Assert.assertFalse(li.isUninitialized());
Assert.assertSame(PersonnelDTO.class,li.getPersistentClass());
Assert.assertEquals("1",li.getIdentifier());
li.setIdentifier("12");
Assert.assertEquals("12", li.getIdentifier());
Assert.assertNotNull(li.getImplementation());
// Object firstName = ((CglibLazyInitializer)li).invoke(proxy, dto.getClass().getDeclaredMethod("getFirstName", null),new String[]{});
// Assert.assertEquals("vivek", firstName);
((CglibLazyInitializer)li).unsetPersistenceDelegator();