### Question:
PersistenceDelegator { boolean contains(Object entity) { Node node = getPersistenceCache().getMainCache().getNodeFromCache(entity, getMetadata(entity.getClass()), this); return node != null && node.isInState(ManagedState.class); } PersistenceDelegator(final KunderaMetadata kunderaMetadata, final PersistenceCache pc); void persist(Object e); E findById(final Class<E> entityClass, final Object primaryKey); List<E> find(Class<E> entityClass, Object... primaryKeys); List<E> find(Class<E> entityClass, Map<String, String> embeddedColumnMap); void remove(Object e); E merge(E e); void detach(Object entity); Client getClient(EntityMetadata m); Client getClient(final String persistenceUnit); EntityEventDispatcher getEventDispatcher(); boolean isOpen(); void refresh(Object entity); boolean isTransactionInProgress(); PersistenceCache getPersistenceCache(); KunderaMetadata getKunderaMetadata();  }### Answer:
@Test public void testContains() { PersonnelDTO dto = new PersonnelDTO(); dto.setPersonId("123"); PersistenceDelegator pd = ((EntityManagerImpl) em).getPersistenceDelegator(); Assert.assertFalse(pd.contains(dto)); em.persist(dto); pd = ((EntityManagerImpl) em).getPersistenceDelegator(); Assert.assertTrue(pd.contains(dto)); em.clear(); pd = ((EntityManagerImpl) em).getPersistenceDelegator(); Assert.assertFalse(pd.contains(dto)); }