/* From spec:
* If X is a new entity instance, a new managed entity instance X' is created
* and the state of X is copied into the new managed entity instance X'.
*/
public void testMergeAsPersist() {
PersonEntity personEntity = new PersonEntity();
personEntity.setName("acct 1");
EntityTransaction tx = em.getTransaction();
tx.begin();
em.merge(personEntity);
tx.commit();
Assert.assertTrue(personEntity.getId() != null, "Id is null. Account object was not persisted by merge().");
PersonEntity a1 = em.find(PersonEntity.class, personEntity.getId());
Assert.assertEquals(a1.getName(), personEntity.getName(), "name was not persisted by merge().");
// verify that two objects are different.
Assert.assertNotSame(a1, personEntity, "New object was not created by merge().");
}