@Test
public void setPModeId() throws PersistenceException {

    // Add a message unit to the database so we can change it
    em.getTransaction().begin();
    UserMessage userMsgJPA = new UserMessage(TestData.userMsg1);
    em.persist(userMsgJPA);
    UserMessageEntity userMsg = new UserMessageEntity(userMsgJPA);
    em.getTransaction().commit();
    // Check it accidentially has not already the new value
    assertNotEquals(T_NEW_PMODE_ID_1, userMsg.getPModeId());
    // Perform the update
    updManager.setPModeId(userMsg, T_NEW_PMODE_ID_1);
    // Check update in entity object
    assertEquals(T_NEW_PMODE_ID_1, userMsg.getPModeId());
    // Check that database is updated
    em.refresh(userMsgJPA);
    assertEquals(T_NEW_PMODE_ID_1, userMsgJPA.getPModeId());
}