}
@Test
public void testMerge()
{
PersonnelDTO dto = new PersonnelDTO();
dto.setPersonId("123");
em.persist(dto);
dto = em.find(PersonnelDTO.class, 123);
Assert.assertNotNull(dto);
dto.setFirstName("kuldeep");
em.merge(dto);
dto = em.find(PersonnelDTO.class, 123);
Assert.assertNotNull(dto);
Assert.assertEquals("kuldeep", dto.getFirstName());
try
{
em.merge(null);
}
catch (KunderaException e)
{
Assert.assertEquals("java.lang.IllegalArgumentException: Entity to be merged must not be null.",
e.getMessage());
}
try
{
em.merge(new PersonnelDTO());
}
catch (KunderaException e)
{
Assert.assertEquals("java.lang.IllegalArgumentException: Entity to be persisted can't have Primary key set to null.",
e.getMessage());