@Before
  public void setUp() {
    user = new UsersDTO("userDBTest" + new Date(), "normal" + new Date());
    entityManager.getTransaction().begin();
    user = userResourceFacadeImp.addUser(user);
    entityManager.getTransaction().commit();

    CrisisTypeDTO crisisTypeDTO = crisisTypeResourceFacadeImp.findCrisisTypeByID(1100L);
    CollectionDTO crisisDTO =
        new CollectionDTO(
            "testCrisisName" + new Date(),
            "testCrisisCode" + new Date(),
            false,
            false,
            crisisTypeDTO,
            user,
            user);
    entityManager.getTransaction().begin();
    crisis = crisisResourceFacadeImp.addCrisis(crisisDTO);
    entityManager.getTransaction().commit();
    getDoc();
    entityManager.getTransaction().begin();
    documentDTO = documentResourceFacadeImp.addDocument(documentDTO);
    entityManager.getTransaction().commit();

    taskAnswer =
        new TaskAnswerDTO(documentDTO.getDocumentID(), user.getUserID(), "test_sample_answer");
    taskAnswer.setFromTrustedUser(true);
    Date date = new Date();
    taskAnswer.setTimestamp(date);
  }
 /** Test of getTaskAnswer(documentId, userId) method, of class TaskAnswerResourceFacadeImp. */
 @Test
 public void testinsertTaskAnswerByDocumentIdAndUserId() {
   taskAnswer.setAnswer("test_sample_answer3");
   entityManager.getTransaction().begin();
   taskAnswerResourceFacadeImp.insertTaskAnswer(taskAnswer);
   entityManager.getTransaction().commit();
   TaskAnswerDTO taskAnswer =
       taskAnswerResourceFacadeImp.getTaskAnswer(documentDTO.getDocumentID(), user.getUserID());
   assertEquals(documentDTO.getDocumentID(), taskAnswer.getDocumentID());
 }
  @After
  public void tearDown() {
    if (taskAnswer != null) {
      entityManager.getTransaction().begin();
      taskAnswerResourceFacadeImp.undoTaskAnswer(documentDTO.getDocumentID(), user.getUserID());
      entityManager.getTransaction().commit();
    }

    if (documentDTO != null) {
      entityManager.getTransaction().begin();
      documentResourceFacadeImp.deleteDocument(documentDTO);
      entityManager.getTransaction().commit();
    }
    if (crisis != null) {

      try {
        entityManager.getTransaction().begin();
        crisisResourceFacadeImp.deleteCrisis(crisis);
        entityManager.getTransaction().commit();
        CollectionDTO result = crisisResourceFacadeImp.getCrisisByCode(crisis.getCode());
        assertNull(result);
      } catch (PropertyNotSetException e) {
        logger.error("PropertyNotSetException while deleting crisis " + e.getMessage());
      }
    }
    try {
      if (user != null) {
        entityManager.getTransaction().begin();
        userResourceFacadeImp.deleteUser(user.getUserID());
        entityManager.getTransaction().commit();
        UsersDTO result = userResourceFacadeImp.getUserByName(user.getName());
        assertNull(result);
      }
    } catch (PropertyNotSetException ex) {
      logger.error("PropertyNotSetException while deleting user " + ex.getMessage());
    }
  }