/**
   * Test to check we can remove a candidate from the database.
   *
   * @throws DaoStoreException
   */
  @Test
  public void testRemove() throws DaoStoreException {
    CandidateDaoJpa dao = new CandidateDaoJpa();
    dao.setEntityManager(this.em);

    Collection<Candidate> found = dao.findAll();
    int initial = found.size();

    // remove the candidate
    Candidate candidate = dao.findById(new Integer(1));
    dao.remove(candidate);

    found = dao.findAll();
    int after = found.size();

    assertEquals("candidate size should have decreased", initial - 1, after);
  }