### Question:
KunderaPersistenceUnitUtil implements PersistenceUnitUtil { @Override public Object getIdentifier(Object entity) { Class<?> entityClass = entity.getClass(); return PropertyAccessorHelper.getId(entity, null); } KunderaPersistenceUnitUtil(PersistenceUtilHelper.MetadataCache cache); @Override boolean isLoaded(Object entity, String attributeName); @Override boolean isLoaded(Object entity); @Override Object getIdentifier(Object entity);  }### Answer:
@Test public void testGetIdentifier() { PersistenceUnitUtil utils = emf.getPersistenceUnitUtil(); Person p = new Person(); p.setAge(32); p.setPersonId("1"); Assert.assertNotNull(utils.getIdentifier(p)); Assert.assertEquals("1",utils.getIdentifier(p)); }
@Test public void testInvalidEntity() { PersistenceUnitUtil utils = emf.getPersistenceUnitUtil(); Person p = new Person(); p.setAge(32); p.setPersonId("1"); try { utils.getIdentifier(new String("test")); Assert.fail("Should have gone to catch block!"); } catch(IllegalArgumentException iaex) { Assert.assertEquals(String.class + " is not an entity", iaex.getMessage()); } }